5 Replies Latest reply on Nov 4, 2009 6:49 AM by kglad

    duplicateMovieClip() problem

    gopal73thakkar Level 1

      hi

      in my project i am making one line graph using createEmptyMovieclip() function, and i want to add facility of making multiple copy of that graph to user and for that copy facility i am using duplicateMovieclip() function but when i execute that only parent object(Graph_mc) is copied and the child object(Line_mc) which is created with help of 'createEmptyMovieclip()' function inside the graph , does not copy.

       


      If i create same object (Line_mc) on '_root' it will copied.

       

      my code is .....

       

      //for create graph

      onClipEvent(load){

      ang = 0

      spd = 2

       

      _root.Graph_mc.CreateEmptyMovieClip("Line_mc",1)

      with(_root.Graph_mc.Line_mc){

      lineStyle(1,0xffff00,100)

      moveTo(0,0)

      }

       

      onClipEvent(enterframe){

      l = spd*Math.PI*ang

      yy = 60*(Math.sin(l*ang))

      ang++

      lineTo(xx,yy)

      xx++

      }

        • 1. Re: duplicateMovieClip() problem
          kglad Adobe Community Professional & MVP

          1)  root.Graph_mc.CreateEmptyMovieClip("Line_mc",1)

           

          should be

           

          root.Graph_mc.createEmptyMovieClip("Line_mc",1)

           

          2)  it's not clear what movieclip(s) those clip events are attached to

           

          3)  you shouldn't use code attached to movieclips

           

          4)  duplicateMovieClip() has some limitations though i don't see you're hitting one.

          1 person found this helpful
          • 2. Re: duplicateMovieClip() problem
            gopal73thakkar Level 1

            kglad wrote:

             

            1)  root.Graph_mc.CreateEmptyMovieClip("Line_mc",1)

             

            should be

             

            root.Graph_mc.createEmptyMovieClip("Line_mc",1)

             

            2)  it's not clear what movieclip(s) those clip events are attached to

             

            3)  you shouldn't use code attached to movieclips

             

            4)  duplicateMovieClip() has some limitations though i don't see you're hitting one.

            sorry for incomplete code and typing mistake in code in forum in my project "c" should be already small.

             

            my remain code is...

             

            //for make a copy of graph

            //click event on movieclip named "copy_mc")

             

            onClipEvent(load){

            var i = 1

            }

            on(press){

            i++

            duplicateMovieClip(_root.Graph_mc,"copyGraph"+i,i)

            }

             

            when i click on "copy_mc" it will create duplicate movieclip named "copyGraph2" with whole "Graph_mc" but in this duplicate moviclip "Line_mc" is not copied

             

            and if i create same "Line_mc" directly on stage with code _root.createEmptyMovieClip("Line_mc",1) and after i click on "copy_mc" with code is duplicateMovieClip(_root.Line_mc,"copyGraph"+i,i), it'll copied

             

            what is the problem i dont know

             

            thanks

            • 3. Re: duplicateMovieClip() problem
              kglad Adobe Community Professional & MVP

              that is a limitation of duplicateMovieClip():  it won't duplicate dynamically created children.

              1 person found this helpful
              • 4. Re: duplicateMovieClip() problem
                gopal73thakkar Level 1

                ok then it is possible to that dynamic object attach to any other movieclip ?

                 

                 

                thanks