I’m trying to embed swf file with some frame labels defined in its timeline into my Flex application:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="1000" height="563" creationComplete="doSomething()">
<mx:Script>
<![CDATA[
private var movieClip:MovieClip;
private function doSomething():void {
movieClip = swfFile.content as MovieClip;
movieClip.gotoAndPlay('playIntro');
movieClip.addEventListener("swfFinished", doSomethingElse);
}
private function doSomethingElse():void {
//
}
]]>
</mx:Script>
<mx:SWFLoader id="swfFile" width="1000" height="563" source="@Embed(source='test.swf')" />
</mx:Application>
However, I cannot control swf timeline in this way… Is it possible to embed swf file and control it in a way I want?
Thanks!
Some searches on this seem to indicate that this is happens when the swf is embedded. If you can get away with not embedding the swf, do that.
Here’s a solution I found that allows the embed to work:
http://iamjosh.wordpress.com/2008/04/09/embedding-flash-in-flex/
I think the issue may lie Flash Player’s security model, just a hunch. It may not be allowing this type of communication with the embedded swf … but you might be able to do something like
Security.allowDomain("*")(a dangerous shortcut).But first, check out the docs for allowDomain, as the docs suggest you might be able to do this:
But I’m guessing that
urlmight be null in the embed case 🙂