1 Reply Latest reply on Mar 31, 2010 5:33 AM by Matt Le Fevre

    Refer to source of embedded graphic

    mattjenn44

      If I am using this type of embedding for a graphic in my MXML

       

      <mx:Image x="0" y="0" id="background" source="@Embed(source='assets/gfx/menu/menu_bg.jpg')" />

       

       

      Can I later reuse that bitmap data elsewhere? eg

       

      <mx:Image x="0" y="0" id="mygraphic"  source="{background}"/>

       

       

       

      Thanks

      Matt

        • 1. Re: Refer to source of embedded graphic
          Matt Le Fevre Level 4

          mattjenn44 wrote:

           

          If I am using this type of embedding for a graphic in my MXML

           

          <mx:Image x="0" y="0" id="background" source="@Embed(source='assets/gfx/menu/menu_bg.jpg')" />

           

           

          Can I later reuse that bitmap data elsewhere? eg

           

          <mx:Image x="0" y="0" id="mygraphic"  source="{background}"/>

           

           

           

          Thanks

          Matt

           

          i imagine changing

           

           

          <mx:Image x="0" y="0" id="mygraphic"  source="{background}"/>

           

           

          to

           

           

          <mx:Image x="0" y="0" id="mygraphic"  source="{background.source}"/>

           

           

          would do the trick

           

           

          although, doing something like this:

           

          <mx:Script>
                  <![CDATA[
                     
                      [Embed(source="assets/gfx/menu/menu_bg.jpg")]
                      [Bindable]
                      public var img1:Class;

                  ]]>
              </mx:Script>
             
              <mx:Image x="0" y="0" id="background" source="{img1}"/>
              <mx:Image x="0" y="0" id="mygraphic"  source="{img1}"/>

           

           

          would be a more proper solution