This content has been marked as final. Show 11 replies
You may have indicated this in your post above, but just to be specific, you must export your SWF as AS3 specifically in the Export dialog, to get that stuff to work in Flex.
Many times you can just set your swf to an Image source="" then use my_image.content.gotoAndPlay(2) etc.
It may also make a difference which object in your swf you are in... Ie. mc.gotoAndPlay() would stop the stage layer, but might not stop a nested timeline.
Thanks for the tips, Slaingod, but it's still not working.
I've selected every symbol in library and ensured that 'export for actionscript' is checked.
I've tried the File->Export->Export Movie option (there's no mention of an actionscript setting in the dialogue box that appears)
My latest attempt was using the 'Class method' of importing a SWF file:
public var test:Class;
myTest = new test();
var ui:UIComponent = new UIComponent();
with the same results: the swf is placed in the application and just keeps looping infinitely.
The images on each frame are movieclips (I've read that only movieclips and buttons can be used), but have no time line, they're just composites of other movieclips.
Getting properties of the newly created SWF file shows nothing. IE: myTest.scenes.name is null, and frames shows up as 0 (even though it's a 2 frame swf)
Any other ideas?
Thanks in advance...
I created another two frame swf file without any library items. One with a simple red square, one with a blue square, with the same results.
Has this got everyone else stumped too? Can anyone else duplicate this problem?
See if this approach works for you. As was mentioned previously, make sure you're publishing to a Flash 9 file (AS3) in the publish settings of the FLA file.
Once I adjusted the source to have a leading . (source="./assets ...) it worked. Without the leading period, I'd get a broken image icon.
However, the stop/start commands don't work if I embed the SWF file in the Flex application. Is this a bug or am I still not getting it?
I'd rather not have to load all the assets from a remote source if I can get away with it.
I haven't tried an embedded SWF yet. I'll let you know what I find.
Note that my quick 'n dirty example really should have some form of complete/error handler for the SWFLoader if you decide to go that route.
I get exactly what you're getting: no control with the embedded SWF. Here's why trying to control the embedded SWF from the embedding app doesn't work ... from the docs:
"Note: You cannot access the properties or methods of embedded SWF files directly. You can, however, use LocalConnection to allow them to communicate."
I know I've read this for Flash 8 SWFs, but apparently this is true for EMBEDDED Flash 9 SWFs as well.
Never had a need to use LocalConnection, but the docs seem pretty thorough on that. Seems like it's a lot of trouble to control your embedded SWF though.
Thank you for all your help VarioPegged; I've seen that mentioned for Flash 8 as well, and loathe to go down that road ...
For this 'limitation' with Flash 9 SWFs: should I file that under 'bug' or 'undocumented feature'? ;-)
There is a viable workaround for this. See slaingod's solution in this post.
I do wish that Adobe would update the docs to reflect that an octet-stream embedded SWF can indeed be controlled by the embedding Flex app.
Yea, sorry I didn't publish that here originally. :)