2 Replies Latest reply on Jul 30, 2007 3:50 AM by WHGibbo

    Access to embed resources

    WHGibbo
      Hi,
      Was wondering if somebody could help.. I have a number of embed resources within my SWF file, but I need to be able to load the resource via a script.
      quote:

      <mx:Array id="myresourceitems">
      <mx:Object label="Item1" icon="@Embed('swf/item1.swf')" filename="swf/item1.swf"/>
      <mx:Object label="Item2" icon="@Embed('swf/item2.swf')" filename="swf/item2.swf"/>
      <mx:Object label="Item3" icon="@Embed('swf/item3.swf')" filename="swf/item3.swf"/>
      </mx:Array>

      The array is used in a tilelist to display the icons, but I want to be able to use the filename when I store the information. The reason for this is so that when I retrieve the information I can load the embed icon. But can't seem to find any code on how to load it..

      I have tried the following:
      quote:

      var imagelocation:String = "@Embed('"+m_Filename+"')";
      var img:Image = new Image();
      img.load(imagelocation);

      But that didn't work

      How can I go about this? Any ideas would be helpful..
        • 1. Re: Access to embed resources
          ntsiii Level 3
          [Embed(source='swf/item1.swf')]
          private var _imagelocation:Class;

          ...
          img.load(_imagelocation);

          Tracy
          • 2. Re: Access to embed resources
            WHGibbo Level 1
            Hi Tracey,
            Firstly thank you for replying and the information. Not sure if that really helps. :(

            I was wondering if there was a way to reference an embed resource by using it's filename or a name.. As at the moment I'm having to search the array for the filename then get reference the icon in order to get the resource.

            I thought there might be a resource manager, that you could use but that doesn't appear to be the case :(

            Thanks