Copy link to clipboard
Copied
My app works but when it gets to the last part where i want to show the addChild Attack and then when it is complete gotoAndPlay(2) it skips out the addChild Attack and moves onto the next frame..
How do i time it so the object movieclip will play and then move onto the next frame..
in my movieclip Attack ii just have the coding stop();
in the frame 1
objectMove.addEventListener(Event.ENTER_FRAME, testHit);
function testHit(event:Event):void
{
var Attack:AttackMC = new AttackMC();
if (objectMove.hitTestObject(objectWall))
{
objectMove.removeEventListener(Event.ENTER_FRAME, testHit);
addChild(Attack);
gotoAndPlay(currentFrame+1);
}
}
thanks.
If you want the Attack to play thru before going to the next frame, then you need to place the gotoAndPlay at the end of the Attack timeline, but it has to target the parent timeline...
MovieClip(parent).gotoAndPlay(MovieClip(parent).currentFrame+1); // in last frame of Attack movieclip
Copy link to clipboard
Copied
I don't see anything telling your Attack movie to play (as in (Attack.play(); ). Is that the one you want to play that you don't see? Or are you trying to make the main timeline gotoAndPlay the next frame like you show now?
Copy link to clipboard
Copied
ii want the attack to play so ii put
addChild(Attack);
and then once it plays in full ii want to move to next frame.
Copy link to clipboard
Copied
objectMove.addEventListener(Event.ENTER_FRAME, testHit);
function testHit(event:Event):void
{
var Attack:AttackMC = new AttackMC();
if (objectMove.hitTestObject(objectWall))
{
objectMove.removeEventListener(Event.ENTER_FRAME, testHit);
addChild(Attack);
Attack.play();
gotoAndPlay(currentFrame+1);
}
}
ii put that in instead and it still misses the attack object movieclip out and just continues to the next frame.
Copy link to clipboard
Copied
If you want the Attack to play thru before going to the next frame, then you need to place the gotoAndPlay at the end of the Attack timeline, but it has to target the parent timeline...
MovieClip(parent).gotoAndPlay(MovieClip(parent).currentFrame+1); // in last frame of Attack movieclip
Copy link to clipboard
Copied
Thank You So Much It Worked
Copy link to clipboard
Copied
You're welcome