9 Replies Latest reply on Sep 12, 2009 4:54 AM by Ned Murphy

    How do you use a variable within an attachMovie statement?

    DeadEyeDog

      Hey guys.

       

      What I'm trying to do is simply this:

       

                               <variable> = mvcShip

       

                               var ship1 = _root.attachMovie( <variable>, shipName + _root.getNextHighestDepth(), _root.getNextHighestDepth() );

       

      What i am trying to attempt here is to make the variable equal to the name of an item in my library. (Im using this to use different ships in an old arcade-style vertical shooter).  This is meant to make a ship appear on stage.

       

      When <variable> is replaced with a library item (eg. mvcShip), it works fine, but if the variable is in place, i get a trace value of ship1 as "undefined", and the ship doesnt show up on the stage.

       

      Any help would be appreciated

       

      P.S. Please ask if you would like me to attach the full code.