views:

190

answers:

0

I embed a swf as ByteArray and load it at runtime with the SWFLoader.

Here is the internal swf that I want to load:

 <?xml version="1.0" encoding="utf-8"?>
 <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
  <mx:Label id="rLabel" text="From InternalSWF"/>
 </mx:Application>

The embeding swf loads it with the following code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"  applicationComplete="main();">
<mx:Script>
<![CDATA[

    import mx.managers.SystemManager;
    import mx.events.FlexEvent;
    [Embed(source="../../InternalSWF/bin-release/InternalSWF.swf", mimeType="application/octet-stream")] mimeType="application/octet-stream")]
    private const internalSWF:Class;        

    public function main(): void
    {
        var binary:ByteArray = new internalSWF() as ByteArray;

        // setup swfloader
        rSwfLoader.trustContent = true;
        rSwfLoader.addEventListener( Event.COMPLETE, onSWFLoaded );
        rSwfLoader.load(binary);
    }

    public function onSWFLoaded( event:Event ): void
    {
    }

]]>
</mx:Script>
<mx:Box>
    <mx:SWFLoader id="rSwfLoader" height="100%" width="100%" 
            scaleContent="true"/>
    <mx:Text id="rText" text="from EmbedingSWF"/>
</mx:Box>

The label "from EmbedingSWF" is shown on both, local and on the webserver. But the label with "From InternalSWF" isn't shown on the webserver, just on the local machine.

With some tests I found out that the internal swf is loaded correctly, because it's later added applicationComplete-Function is called.

Is this a bug in Adobe-Flash-Player or am I missunderstanding something ?

Update: Internet Explorer is fine. Firefox and Chrome not...

2nd Update: I am using swfObject in javascript to include the swf: swfobject.embedSWF("../res/flash/EmbedingSWF.swf?v="+version, "flashcontent", width, height, "9.0.0", "../res/flash/expressInstall.swf", flashvars, params, attributes);

3rd Update: It works when I use AC_OETags instead of SWFObject. Don't know why yet...