[haXe] haxe JS remoting without ExternalInterface

Marcus Bergstrom marcus at quickform.net
Thu Feb 15 10:13:18 CET 2007


Hi Roberto,

Why wouldn't you just use the flash/javascript remoting? It works  
nicely.

Regards

-----------------------------------------------------------
Marcus Bergstrom [marcus at quickform.net]
-----------------------------------------------------------



On Feb 15, 2007, at 4:16 AM, Roberto Saccon wrote:

> Some time ago I started to port the Flash / Javascript bridge from  
> the dojo toolkit from Actionscript to haxe. I did the easy part  
> which is based on ExternalInterface, but now I would like to bite  
> into the difficult part, without External Interface (for  
> flashplayer < 8 or for very large data transfers as it is typical  
> for local storage), but it seems to be difficult.
>
> Let me first explain how it is currently working at the  
> Actionscript version:
>
> There is a DojoExternalInterface Actionscript class which can be  
> imported into any flash movie which wants to use the Bridge. Flash-  
> to-Javascript uses fscommand, for Javascript-to-FLash see  
> explanation below.  When the Javascript-bridge gets initialized, a  
> small helper swf is loaded, which just contains two frames with the  
> following Actionscript codes:
>
> Frame 1:
> ------------
> //  initialization, registering callbacks
> DojoExternalInterface._gatewayReady();
> stop();
>
> Frame 2 (labeled as 'execute'):
> ------------
> //  invoking a flash function
> DojoExternalInterface._handleJSCall();
> stop();
>
>
> Now the trick is, when Javascript wants to invoke a flash function,  
> it sets the signature with some 'SetVariable' on the flashmovie DOM  
> object, then it calls TCallLabel("/", "execute"); on the flash DOM  
> object which invokes the the calls in the second  frame of the   
> helper swf from above, then it retrieves the result with
> 'GetVariable' .
>
>
> Now the question is, how can I port that mechanism to haxe (if  
> possible at all ...). If I leave the two-frame helper SWF in  
> Actionscript, but the hosting flash movie (which loads the helper  
> swf) in Haxe, then how can I invoke directly functions in the  
> hosting swf ? Or should I rather look into writing the helper swf  
> in haxe ? But how ? With swfmill ? Or go as low-level as hacking  
> haxe compiler to generate multframe swf files ? Or is there an easy  
> solution for this kind of problems ?
>
> regards
> -- 
> Roberto Saccon
> -- 
> haXe - an open source web programming language
> http://haxe.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070215/dd0deb03/attachment.htm


More information about the Haxe mailing list