Passing variables between Flash and Rev

Dave Cragg dave.cragg at lacscentre.co.uk
Mon May 19 16:53:11 EDT 2008


On 19 May 2008, at 19:11, Henk van der Velden wrote:

> Thanks a lot; I'll dive into this.
> Henk

I got intrigued, and managed to get something working. (It needs Flash  
Player 9.) You can try this in the Rev message box.

go url "http://www.lacscentre.co.uk/flex/socketTest/FlashSocketTest.rev"


When the stack loads, click the Setup button. It will load a swf file  
using revBrowser.

When the swf file has loaded, click its "Get Environment From Rev"  
button. Hopefully, it will display the environment variables and time  
supplied by Rev.

Troy wrote:

> In the end, it works like this... you have Rev start listening for a  
> socket connection, you have Flash connect to it, and you start  
> communicating back and forth.

I had trouble working out how to manage the connection from the Rev  
side. If you want Rev to push data to the Flash element at arbitrary  
times, you need to keep the connection open. But if you also want to  
accept data from the Flash element, doesn't the Flash script need to  
reset the connection prior to sending data otherwise Rev doesn't know  
when to read from the socket. In the example above, Rev closes the  
socket each time after sending the data, forcing the Flash component  
to reconnect. Is there a cleaner approach to this?

Cheers
Dave


More information about the use-livecode mailing list