Flex 1.5 – Embedbed image problem, when using multiple Flex SWFs

Posted on May 30, 2006 | Comments Off

I have 2 Flex applications. The first application (swf1) loads the other application (swf2). “swf1″ has an embedded image inside it, when I try and access the embeded image in “swf2″ nothing happens.

The best way to explain it is with some sample code (source can be found here):

swf1:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*">

    <mx:Script>
        <![CDATA[
            // Logo Asset(s)
            [Embed(source="green.gif")]
            var myImage:String;
           
            private function doneLoading():Void {
           
            }
      ]]>
    </mx:Script>

    <mx:Loader id="BaseContainer"
        source="swf2.mxml.swf"
        width="100" height="100"
        scaleContent="false" maintainAspectRatio="false"
        complete="doneLoading()"
        borderColor="0x0000FF" borderThickness="2" borderStyle="solid"/>

    <mx:Image source="{ myImage }" borderColor="0xFF0000"/>
</mx:Application>

swf2:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*">

    <mx:Image source="{ parentApplication.myImage }" />
    <mx:Image source="{ parentApplication.myImage }" />
    <mx:Image source="{ parentApplication.myImage }" />
    <mx:Image source="{ parentApplication.myImage }" />
    <mx:Image source="{ parentApplication.myImage }" />


</mx:Application>

I am looking for an example of this working or somebody to tell its just the way it is???