Skip to main content
Known Participant
September 22, 2007
Question

Inquiring about the frame of an MC

  • September 22, 2007
  • 3 replies
  • 192 views
Hi, I'm resuming work on my game. And the question I have is, how do I figure out at a given point, where a MC is on its animation cycle?

something like
if (frame.player == 1) {
//do something
}

The reason I ask is because sometimes the player gets stuck on frame 1, and I want to push him to frame 2.

Please check it out for yourself:
http://theultimateeverything.com/game.html

game.fla is also available

One second question:
If I put script on frame 2 of the player's animation saying gotoandplay(3);
the animation looks funny, as if it skipped frame 2, or went over it really fast.. Is this in fact what happens when you use gotoandplay?

Thank you!
This topic has been closed for replies.

3 replies

clbeech
Inspiring
October 7, 2007
close, call the target clip first:

if(player._currentframe==2) {
//the action
}
Known Participant
October 7, 2007
Thanks!
How exactly do I check the currentframe property of a MC?

Do I say something like
if (_currentframe.player == 2) {

thanks
Inspiring
September 22, 2007
if its as2
then you just check the _currentframe property. Its readonly... to move the playhead you use play, gotoAndPlay, gotoAndStop etc.

see here:
http://livedocs.adobe.com/flash/9.0/main/00001903.html#wp373076

re your second question, I don't know the answer for sure. gotoAndStop or gotoAndPlay does not appear to prevent remaining code from executing in that frame... but it I believe it advances the playhead immediately and executes the old frame's remaining code (ie. what executes after the gotoAndPlay instruction) in the context of the target frame. This is based on some simple tests with trace(_currentframe) on each frame and some timer related checks as well. Others may know more about this... and perhaps what I observed is not correct under all circumstances.