FORUMS: list search recent posts

Play MC1 when MC2 hits a certain frame

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Keith Anthony
Play MC1 when MC2 hits a certain frame
on Jul 8, 2013 at 3:37:35 pm

I have MC1 that when clicked i would like it to wait so it starts playing when MC2 hits frame 50 or 100. both have their own separate timeline. Any Help?


Return to posts index

Sam Mattern
Re: Play MC1 when MC2 hits a certain frame
on Jul 9, 2013 at 12:54:59 pm

Without knowing more, seems like you need an event listener on MC2 that starts listening for "enterFrame" when you stop MC1. Something like:

MC2.addEventListener("enterFrame",checkFrame);

function checkFrame(e:Event):void{
if(e.target.currentFrame == 50){
MC1.gotoAndPlay(whatFrame);
}
}


Now I have no idea if MC1 and MC2 are within scope of each other, so this code will have to be tweaked to fit your schema, but the concept should work. "whatFrame" should be whatever frame you want MC1 to play on. You can put in a hard value or store the current frame of MC1 when it's stopped and reference that variable in the checkFrame function.

-Sam


Return to posts index

Keith Anthony
Re: Play MC1 when MC2 hits a certain frame
on Jul 29, 2013 at 11:14:54 pm

Worked perfectly, Thanks


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]