Sprite animation with ENTER_FRAME
I have 2 mc in my library (mc_1 and mc_2) and 1 sprite. The mc's are the children of the sprite.
I write this code to put them on stage:
var m1: mc_1 = new mc_1;
var m2: mc_2 = new mc_2;
var g: sprite = new sprite();
m1.x = 0;
m2.x = 60;
g.addChild(m1);
g.addChild(m2);
addChild(g);
Now I want to start an animated switch between these 2 mc's using Event.ENTER_FRAME (m1 goes to the place of m2 and m2 goes to the place of m1 only on x axis). This should happen when I click on m1 or m2. How can I do that?
My function for animation is this:
function movePieces (event:Event) :void
{
var i: int;
for (i = 0; i <= 60; i = i +5)
{
t1.x = i;
t2.x = 60 - i;
}
}
