1 Reply Latest reply on Nov 21, 2009 8:48 AM by harihisu

    Issues with Embed tag ..

    Ankurwahi

      Hi.I have the problem with the embed tag.

       

      When I try to do this

       

      [Embed(source="images/21.jpg")]
      var EmbedPic:Class;
      It works fine.

       

      But when I try this

       

      var str:String="images/21.jpg"
      [Embed(source=str)]
      var EmbedPic:Class;

       

      It doesn't work.

       

      So how can I be able to embed the images whose path are coming at runtime from a variable .
      Or any other solution for embedding an images directly in flash whose paths are coming from xml.

       

      Thanks........
      Regards
      Ankur

        • 1. Re: Issues with Embed tag ..
          harihisu Level 2

          When using [Embed] metadata tag, the picture will be embedded into your swf at compile time, not runtime.

          To load a picture at runtime, create an Image instance and load the corressponding URL

           

          var img:Image = new Image();
          img.load( "images/21.jpg" );