2 Replies Latest reply: Jun 11, 2013 7:28 PM by Departure RSS

    Adding Animation to a Dynamically Created MovieClip

    Departure Community Member

      Imagine i do not want to use Timeline and i do not want to create a movieClip instance in Library to be exported to Action Script

       

      Instead, I want to use the first frame on stage to create movieclips and add animation to them via functions. like this:

       

      var DynamicClip:MovieClip=new MovieClip

      buildMovieClip( some variables)

       

      function buildMovieClip(some variables)

      { DynamicClip.graphics(blah blah)

        addChild(DynamicClip)

        DynamicClip.addEventListener(Event.ENTER_FRAME, animatePixels)

      }

       

      function animatePixels()

      { some codes to make those pixels move}

       

      Now this all works fine except the fact that the animation is not part of the MovieClip. so if I decide to ratote the whole thing or scale it or whatever, the animation is not affected. How can I actually "indent","attach","include" the animations i coded into the movie clip symbol and then hopefully give it a name so i can duplicate it. everything with no dependancy on library and manually created symbols.

       

      Thanks in Advance...

        • 1. Re: Adding Animation to a Dynamically Created MovieClip
          Ned Murphy CommunityMVP

          You should  stick with your other posting and not start new ones for the same topic.  From the other posting I see you use addChild when you say you want to add the object to the MovieClip.  If you want to add the object to the MovieClip so that the child rotates with the MovieClip, then you need to use MovieClip.addChild

          • 2. Re: Adding Animation to a Dynamically Created MovieClip
            Departure Community Member

            Thanks Ned...

             

            Another quick question related to the same subject:

            How can i create a MovieClip only ONCE and have multiple copies of it in different locations?

             

            For loop

            {

              Array[i]=Only_movieClip

            Array[i].x=i*5

              addChild(Array[i])

            }

             

            i cant achieve this unless i create as many new MovieClips. When u use = operator, doesnt it mean you rinse/drop the movieClip inside the Array/Cup and further on you can modify each cop on its own? (.x property lets say) ?