duplicate Mc

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shawn Northrop
    New Member
    • Jan 2007
    • 67

    duplicate Mc

    Code:
    _root.text_mc.duplicateMovieClip("test",1);
    _root.test._x="10";
    _root.test._y="10";
    I have a mc called text_mc Inside is a colored line. There is no instance of this clip, it is in the library. I am trying to generate an instance. The above code seems to not do anything. Is there something i am missing? Eventually i would like to put this in a loop and have:

    Code:
    duplicate....("test"+i,i);
    _root.test+i._x=..... ??????
    I am unsure about the line with the ???? i dont think that would work, is there another way?

    Thanks
  • rsdev
    New Member
    • Jul 2007
    • 149

    #2
    Originally posted by Shawn Northrop
    Code:
    _root.text_mc.duplicateMovieClip("test",1);
    _root.test._x="10";
    _root.test._y="10";
    I have a mc called text_mc Inside is a colored line. There is no instance of this clip, it is in the library. I am trying to generate an instance. The above code seems to not do anything. Is there something i am missing? Eventually i would like to put this in a loop and have:

    Code:
    duplicate....("test"+i,i);
    _root.test+i._x=..... ??????
    I am unsure about the line with the ???? i dont think that would work, is there another way?

    Thanks
    Hi Shawn,

    FInd text_mc in the library 'right-click' and tick the box that says export for runtime sharing. Then you can access the clip in your AS.

    When referencing dynamic names you can use [].

    _root["test"+i]._x=....

    Comment

    • Shawn Northrop
      New Member
      • Jan 2007
      • 67

      #3
      Did you mean export for actionscript? I have that checked. The other option wanted a url? anyways i posted my file online. Its extremely small and simple. Could someone please check it out and let me know? Thanks

      www.jeannefligh t.com/xmltest.fla

      Comment

      • rsdev
        New Member
        • Jul 2007
        • 149

        #4
        Originally posted by Shawn Northrop
        Did you mean export for actionscript? I have that checked. The other option wanted a url? anyways i posted my file online. Its extremely small and simple. Could someone please check it out and let me know? Thanks

        www.jeannefligh t.com/xmltest.fla
        Hi Shawn,

        Apologies I meant export for actionscript. A little tired when I wrote the reply.

        Then the identifier is how you would acees the clip using attachMovie in actionscript. Then you can duplicate the clip.

        Comment

        • rsdev
          New Member
          • Jul 2007
          • 149

          #5
          Otherwise you can drag the text_mc somewhere off stage and name it. From there you can duplicate the clip.

          Comment

          • rsdev
            New Member
            • Jul 2007
            • 149

            #6
            Originally posted by rsdev
            Otherwise you can drag the text_mc somewhere off stage and name it. From there you can duplicate the clip.
            If you want to change the settings of clip after duplicating try this;

            Code:
            circle_mc.duplicateMovieClip("circle1_mc", this.getNextHighestDepth(), {_x:20, _y:20});
            The curly brackets set init properties. Or;

            Code:
            var clip = _root.text_mc.duplicateMovieClip("circle1_mc", 10);
            with(clip){
              _x = 210;
              _y = 210;
            }
            Hope this helps!

            Comment

            Working...