Flash/QuickTime interaction with Revolution

Scott Rossi scott at tactilemedia.com
Thu Sep 16 13:34:15 EDT 2004


Recently, Trevor DeVore  wrote:

>> (BTW, many months ago, some kind soul on the list sent me a file that
>> demonstrates communication between Flash and Rev using sockets.  For
>> the
>> life of me, I can't find the sample nor do I recall the person who
>> sent the
>> example so if this person is reading now, perhaps you can step out of
>> the
>> shadows and reveal yourself? :-)
> 
> It wasn't me who posted originally but I did play around with the
> concept after reading that post.  This is the code I have in the
> concept stack I made based on the post.  If I remember correctly I was
> using this with the Flash XML object using sockets.

Cool Trevor.  You inspired me to look a little deeper in my archives and I
finally found the example, from Gary Rathbone.  Looks a bit similar:

------------------------------------------------

When I click on a button in Flash I get a "HelloRev" message in my Rev
stack. Rev then returns a "HelloFlash" message. So the two can talk to each
other and pass parameters for parsing and other actions. When I said I was
no Flash expert I actually meant I'd never used the program, so I'm sure
there's much more on the Flash side that can be done rather that just
displaying the Rev response in a browser.

In Flash I created a button with the following script...

-----------
on (press) {
getURL("http://127.0.0.1:8181/$HelloRev$", "_blank");
}
-----------

I then created a stack with a single button 'Start' and a field 'tfld'. The
'Start' button has the following script. This is very similar to the
Javascript/WebForm/Browser 'integrator' stack previously published.

-----------
on mouseup
  put "" into fld "tfld"
  get the OpenSockets
  repeat with c=1 to the number of lines in it
    close socket (line c of it)
  end repeat
  accept connections on port 8181 with message "wRequest"
end mouseup

on wRequest skt
  set the itemdel to "$"
  set the socketTimeoutInterval to 20000
  read from socket skt for 1 line
  put item 2 of it into fld "tfld"
  write "HelloFlash" to socket skt
  close socket skt
end wRequest
-----------

So, Rev is 'listening' for a request on port 8181 of IP 127.0.0.1 (which is
the local machine - you don't need to change this IP address as every (?)
computer uses this IP address as its own reference - the loopback IP). When
the Flash button is pressed it sends a request to the Rev stack which parses
the parameter and puts the result into the field. Rev then returns a string
which currently appears in a browser window, but I'm sure someone more
competant in flash could do more with this...

Hope this helps.

Regards

Gary Rathbone

------------------------------------------------

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list