Getting Return values when calling JavaScript Functions from ActionScript / Flash

I added a page to the Flash / JavaScript Integration Kit project documents that shows how to get return values from JavaScript when calling JavaScript functions from Flash.

The same technique works when calling Flash function from JavaScript, by just reversing the code.

You can view the code / example here.

You can find out more about the Flash / JavaScript Integration Kit here.

Related Entries

Comments

  1. Fabrizio
    June 24, 2005 4:02 AM
    Hello Mike, do you think will be possible a Flash/Javascript synchronous communication in the future? Thanks.
  2. mike
    June 24, 2005 7:43 AM
    In your code example for broadcasting an event - you have in the Class MyClass //declare EventDispatcher functions private function dispatchEvent; public function addEventListener; public function removeEventListener; shouldn't that be private var dispatchEvent:Function; public var addEventListener:Function; public var removeEventListener:Function; Mike
  3. mike chambers
    June 24, 2005 8:53 AM
    Good catch. I just updated it and corrected the error. mike chambers mesh@macromedia.com
  4. Mike
    June 24, 2005 12:47 PM
    No worries - I'm good at catching stuff like that. In fact I'd make a great Flash beta tester ;-) yeah I'm not funny! Mike
  5. chaitanya
    June 26, 2005 8:25 AM
    pls tell about how to add flash files into my web home page pls give some exaples
  6. mrbbp
    June 27, 2005 6:16 AM
    Sorry Mike i'm certainly a stupid guy but when i include your code (actionscript part) in flash and want to test syntax... Flash, say it enable to include a class like that, have put in an external .as file. if i do that how to call the class ? yes i know this is certainly very easy for your guru level, but not for mine.... ;( please give us a .fla file or a zip file or a better tutorial ;) (sorry for that). best regard and great job when it'll work for me.
  7. mrbbp
    June 27, 2005 8:31 AM
    Well i've tested the patterson's tut and that work's... don't know why from scratch that doesn't work. i'm certainly an idiot. sorry.
  8. July 22, 2005 10:55 PM
    Mike, Thought you might like to check out an implementation of the JavaScript -> Flash: http://www.wimpyplayer.com/products/mp3/javascript_mp3_player.html -mike
  9. Laurent
    July 27, 2005 1:53 AM
    Hi Myke, In my actionscript, I have : proxy.call("myjsfunction",mytext); when the length of mytext is more than 480 chars, the call doesen't work. What is the maximum length for an argument when calling a javascript function from actioscript ? Can I change it somewhere in the sources ? Thanks a lot for that product... Laurent.

Post a comment




Remember Me?

(you may use HTML and Quickcode tags for style)