I’ve seen a number of questions regarding the interaction between a SWF and Flex. The idea is that you create some Flash content, perhaps a navigation bar, and you want to have events that happen within the SWF processed by the Flex app in which the SWF is embedded. Or you have the reverse: controls in the Flex app modify the behavior of an embedded SWF.
Both types of interactions are possible. You will be able to cook up more elaborate and elegant solutions, but this should get you started.
The sample file contains a Flash document and Flex application. The Flash document contains a spinning ball and a few functions. The Flex application controls the color of the ball and can pause or resume its spin. The ball in the Flash document is covered by an invisible button which when click, invokes a method in the Flex application.
The key here is the Flex Loader’s content property. Once the SWF has loaded and the Loader fires its “complete” event, the content property is the SWF.
You can pass a reference to the Flex application (or any component) to the SWF in the complete event handler:
<mx:Loader source=”Ball.swf” complete=”event.target.content.flexApp=this” />
Within the SWF, you can now reference “flexApp” and invoke the “onBallClick” function.
Once the SWF has been loaded into the Flex application, you can invoke methods or set values in the SWF from the Flex application. For example, when you press the Pause (Flex) button, the SWF’s pause() method is invoked:
loader.content.pause();
Use the sample files as a guide to building your own hybrid applications.
Tip: Try not to use any of the Halo (or V2) components in your Flash document. The Flex components and Flex components while similar are not 100% compatable. Besides, why would you use buttons, labels, and datagrids in Flash when you have Flex?!?

<mx:VBox width=”400″ height=”400″>
<mx:Image id=”swf” source=”Flash/JustMovie.swf”/>
<mx:Button label=”gotoAndStop” click=”swf[0].gotoAndStop(9)”/>
<mx:HSlider width=”320″ id=”slider” tickInterval=”1″ minimum=”1″ maximum=”15″ snapInterval=”1″ change=”swf[0].gotoAndStop(slider.value)” liveDragging=”true” />
</mx:VBox>
can u upload some examples for this?
Oh! Too has been really good!
Chris Phillips’s examples is very good too!
Ok – now just tell me how to load a Breeze Presentation SWF (that main.swf) into Flex and I owe you some beer
What about Flash Paper 2 .swf? Tried to load it into Flex, didn’t happen … just a broken image icon showed after some delay…
Thanks!
You should be able to load a Flash Paper SWF using
Could you please point to a sample for loading Flash Paper into Flex?
It loads fine into Flash with 2 lines of code, but with Flex I am experiencing problems – especialy with the size. I took sample from Flash Paper 2 home page and it will size to maximum of 300x150px. Tried absolute/relative sizes for and even wrapping in but it won’t size beyond 300×150. Here is mine:
I’ve also noticed some inaccuracies in behaviours of some components in Flash players for Win MS IE vs. Mozilla. Is there a bug resource/listing somewhere available?
code sample in re. prev. post was removed, so again here without tags:
mx:HBox width=”100%” height=”100%”
mx:Image source=”frontdoor_doc.swf”
mx:HBox