1 Reply Latest reply on Mar 18, 2010 9:53 AM by DigitalArchitectCanada

    Is it possible to use attachMovie with a variable ID reference?

    gbowhall
      Hello:

      I am trying to write an attachMovie statement with a variable feeding the ID parameter. Is that possible?

      For Example:
      fadeInVar = '"LS_body_home_ID"';
      _level0.LS_hitArea_body.attachMovie([fadeInVar], "attached_LS_body", 1);

      I can't quite figure out how to write this. I tried an eval function as well...


      If you have any ideas, please let me know.


      Thank you!

      - Garrett



        • 1. Re: Is it possible to use attachMovie with a variable ID reference?
          DigitalArchitectCanada Level 3

          I'm not so sure that this will even work but off the top of my head I can say remove the [] from around [fadeInVar].

           

          AS2... not sure if this will work. I know in AS3 it wouldn't. It would for sure work if you externalized your images/swfs from the library and used a moviecliploader to load in a swf/image from a URL.

           

          function loadFile(fileURL:String):Void

          {

           

               var mcl:MovieClipLoader = new MovieClipLoader();

               mcl.load(fileURL, container); //Where container would be the display object (movieclip or Bitmap) that you wanted to load the item into.

           

               //To dynamically create something you can add the image into, do this

               /*

               var mcContainer:MovieClip = stage.createEmptyMovieClip("containerClip" + stage.getNextHighestDepth()");

               mcl.load(fileURL, mcContainer); //Where container would be the  display object (movieclip or Bitmap) that you wanted to load the item  into.

          }

           

           

          Use of the above function would be:

           

          loadFile("images/image1.jpg");

          Let me know if that helps.