3 Replies Latest reply on Feb 6, 2008 12:54 PM by ntsiii

    Embedding an image chosen dynamically?

    Handycam Level 1
      In the past, to keep my app self-contained I have embedded images, as in:

      <mx:Image id="stepImage" width="120" height="120" source="@Embed('../assets/2.png')" />

      However, now I need to choose one of 2 images, depending on the path chosen. So I'm trying:

      if (app._pathChosen == 2){
      var _imgPath:String = _data.bodyText.attribute('img');
      stepImage.source = _imgPath;

      This works if the image is available to load at runtime, but I'd still like a solution that embeds both images (2a.png and 2b.png) and then allows me to set the source of the image component with Actionscript.

      How can I do this?