Flash CS3 and Flex 2 communication using ActionScript 3.0
Here is an example that demonstrates how to control the timeline of an SWF that was published with Flash CS3 from AS3 code in a Flex project. The Flash CS3 based SWF is set to publish for Flash Player 9 and uses ActionScript 3.0. The SWF is loaded into Flex using a SWFLoader control. Once it is loaded functions on the timeline of the loaded SWF can be called from functions in the Flex project.
This is something I have wanted to look into for a while now. I just got the chance last night while working on the Odeo API example. Using this technique really starts to blur the lines between Flex and Flash CS3. I think this approach also opens the door to more opportunities for interesting UI development.

That’s very cool man!
[...] for animation and the search text field has a real time “web 2.0″ reflection. A little bit of Flash CS3 to Flex communication going on here [...]
Is there any way you could maybe post the source code for both of these showing an example?? I have been trying to find the best way to communicate between flash and flex for awhile… I am currently using LocalConnection to send strings from a flash menu to a flex interface…. doing it this way would be a lot easier..
nevermind… the source code is right there…
I have a quick question for you, is there a way for the flex to detect a keypress in the flash and load something from it ie. I have a flash menu, the user clicks one of the buttons(there movieclips) and I want the flex to load the associated .swf
Hi,
Thanks for this article, it is very usefull information.
The sample swf & mxml works fine, however I am having trouble recreating this functionality if I start from the fla.
I tried to export to swf from the library panel and from file->export movie, but when flex loads the swf the content object was of type “MovieClip” and so did not have the setFlashText method or the animhorse_mc movie clip member. I am using CS3 and Flex builder 2.
This is probably a Flash noob question, but I can’t find info anywhere so any tips would be appreciated.
Hi!
Nice example! All works!!
to “Yotam on December 9th, 2007 at 11:30 am”
this hapens becourse of garbage collector removes you function - unless you use it inside SWF
Hi!
Thanks for the example… is it possible to do this the other way ’round? I need to call a function in a flex application from a flash movie.
Any suggestions?
[...] http://seantheflashguy.com/blog/2007/09/27/flash-cs3-and-flex-2-communication-using-actionscript-30/ [...]
How to control Flash CS3 and Flex 3 communication using ActionScript 3.0?
is this possible with Flash 8 and Action Script 2?
Gah. I can’t get this to work. When I debug it says passes me the “Error #1009: Cannot access … a null object reference.”
But it’s buggy though. The functions never works in debug mode but it does sometimes running in normal mode. When I pull in a fresh version of the Flash swf it works (not debug mode) but if I modify anything it just sits there (apparently passing the error).
Otherwise it seems like a great way to solve the problem.
[...] the Flex Guy has an excellent and simple tutorial for doing half of what I needed. It loads in a Flash swf animation, and then Flex talks to it to [...]