1 Reply Latest reply on May 28, 2006 9:55 AM by Rothrock

    Targeting movie clips

    astou_7455
      I have made a display movie clip called display_mc which contains several movie clips circle 1, 2 etc ...

      I create display_mc by

      this.display_mc = createEmptyMovieClip("display_mc", 50, {_alpha:0});


      Then i attach circle1 by

      this..display_mc.attachMovie("circle", "circle1_mc", 15);

      My question is how do I target Circle1_mc ?

      By _level15 ?

      or by display_mc.circle1_mc ?


      Thx a lot.
        • 1. Re: Targeting movie clips
          Rothrock Level 5
          You are mixing up depths and _levels. They are different things. (very different!) See this tutorial: http://www.kirupa.com/developer/actionscript/depths.htm

          First I'm sure you meant to only use one dot between this and display_mc?

          And next, I'm glad you posted here because otherwise you might go on thinking levels and depths are the same thing, BUT (and it is a big but ) couldn't you have tested this yourself in probably about 1/1000000th the time it takes to get an answer?

          As I'm sure you must have figured out by now, the correct answer is display_mc.circle1_mc.

          Also I think your createEmptyMovieClip structure is a bit wonky. I know you didn't ask, but hey you get what you pay for!

          the createEmptyMovieClip() method does return a reference to the newly created clip. But I think your usage (while not technically wrong) has the potential to be confusing. Why are you creating a variable called display_mc to hold a reference to a clip called display_mc? They have the same name, but one is the thing itself and the other a reference to it. Seem like a great place to get confused in the future. Here is what I would do.

          currentClip=this.createEmptyMovieClip("display_mc",50);
          currentClip._alpha=0;
          currentClip.attachMovie("circle","circle1",15);

          Your usage of the initObject in the creatEmptyMovieClip is just fine, I was just showing you how you could use the returned variable to change a property (like _alpha) as well as invoke a method (like attachMovie()).