all groups > flash actionscript > september 2007 >
You're in the

flash actionscript

group:

Inquiring about the frame of an MC



Inquiring about the frame of an MC FlashMonkey666
9/22/2007 12:00:00 AM
flash actionscript: 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!
Re: Inquiring about the frame of an MC GWD
9/22/2007 12:00:00 AM
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) [i]in the context[/i] 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.
Re: Inquiring about the frame of an MC FlashMonkey666
10/7/2007 6:37:51 PM
Thanks!
How exactly do I check the currentframe property of a MC?

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

Re: Inquiring about the frame of an MC clbeech
10/7/2007 7:47:03 PM
close, call the target clip first:

if(player._currentframe==2) {
//the action
AddThis Social Bookmark Button