embedded SWF isn't shown (SWFLoader)

Posted by Trantec on Stack Overflow See other posts from Stack Overflow or by Trantec
Published on 2010-05-31T07:45:41Z Indexed on 2010/05/31 8:42 UTC
Read the original article Hit count: 346

Filed under:
|
|

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...

© Stack Overflow or respective owner

Related posts about flash

Related posts about flex3