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
- Flash and Web 2.0
- Macromedia Developer Relations Podcast #1
- Community MX Tutorial on Flash / JavaScript Integration Kit
- Fixed : Problems compiling Flash / JavaScript Integration Kit
- Flash / JavaScript Integration Kit Update / Bug Fix
Comments
-
FabrizioHello Mike, do you think will be possible a Flash/Javascript synchronous communication in the future? Thanks.
-
mikeIn 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
-
mike chambersGood catch. I just updated it and corrected the error. mike chambers mesh@macromedia.com
-
MikeNo 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
-
chaitanyapls tell about how to add flash files into my web home page pls give some exaples
-
mrbbpSorry 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.
-
mrbbpWell 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.
-
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
-
LaurentHi 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.