5 Replies Latest reply on Sep 25, 2006 9:29 AM by Newsgroup_User

    duplicating a movieclip wont work properly (v3)

    Level 7
      I have a mc called "Bola_btn" on root and I want to duplicate it using trhis
      code.

      play_btn = 'play_btn';

      Bola_btn.duplicateMovieClip(play_btn, _root.getNextHighestDepth());

      var botn = eval(play_btn);
      botn._x=200;
      botn._y= 300;

      It duplicates it but it doesnt move it... what am i doing wrong???

      Cheers to everyone.



        • 1. Re: duplicating a movieclip wont work properly (v3)
          Rothrock Level 5
          I don't really know how to explain what you are doing wrong other than that isn't the way to do it.

          Check the help file for the duplicateMovieClip() method. I think it returns a reference to the clip. If that is the case you could do this:

          botn=Bola_btn.duplicateMovieClip(play_btn,1000);
          botn._x=200;
          botn._y=300;

          Also I think you can create an init object and give that to the duplicate.

          finally if you really want to go this way you could do something like

          Bola_btn[play_btn]._x=200;

          That is if I'm following correctly and the new button is being duplicated as a child of Bola_btn.

          PS: If Bola_btn is a movieclip why are you giving it a btn suffix?
          • 2. Re: duplicating a movieclip wont work properly (v3)
            Level 7
            Thanks for the answer.

            The help says:
            duplicateMovieClip(target:MovieClip, newname:String, depth:Number) : Void

            That means it doesnt return anything, right?


            play_btn is not a child of bola is a movieclip duplicated whick they stay in
            the same level, the look the same but the are different. (different
            actions).

            Is called _btn because is going to ahndle actions but is a mc really.

            Hmmm....

            Thanks for the interest. :)


            "Rothrock" <webforumsuser@macromedia.com> escribió en el mensaje
            news:ef8oph$2hr$1@forums.macromedia.com...
            >I don't really know how to explain what you are doing wrong other than that
            > isn't the way to do it.
            >
            > Check the help file for the duplicateMovieClip() method. I think it
            > returns a
            > reference to the clip. If that is the case you could do this:
            >
            > botn=Bola_btn.duplicateMovieClip(play_btn,1000);
            > botn._x=200;
            > botn._y=300;
            >
            > Also I think you can create an init object and give that to the duplicate.
            >
            > finally if you really want to go this way you could do something like
            >
            > Bola_btn[play_btn]._x=200;
            >
            > That is if I'm following correctly and the new button is being duplicated
            > as a
            > child of Bola_btn.
            >
            > PS: If Bola_btn is a movieclip why are you giving it a btn suffix?
            >


            • 3. Re: duplicating a movieclip wont work properly (v3)
              kglad Adobe Community Professional & MVP
              actually, if you used different names for your string and variable, your code would work:
              • 4. Re: duplicating a movieclip wont work properly (v3)
                Level 7
                Ok thanks!

                I made it work before but i did it other way.

                I will know for the next time :)


                "kglad" <webforumsuser@macromedia.com> escribió en el mensaje
                news:ef8q48$47u$1@forums.macromedia.com...
                > actually, if you used different names for your string and variable, your
                > code
                > would work:
                >
                > play_btnVar = 'play_btn';
                >
                > Bola_btn.duplicateMovieClip(play_btn, _root.getNextHighestDepth());
                >
                > var botn = eval(play_btnVar);
                > botn._x=200;
                > botn._y= 300;
                >


                • 5. Re: duplicating a movieclip wont work properly (v3)
                  Rothrock Level 5
                  Are you looking at the MovieClip.duplicateMovieClip() method? Anyways a bit down it should specifically says, RETURNS and then either something or nothing.