AS: _currentframe

13,150 Views | 41 Replies
New Topic Respond to this Topic

Response to AS: _currentframe 2007-12-22 01:23:00

wow thanks man!

im using this code now:D


Response to AS: _currentframe 2008-04-13 10:55:59

This was useful, I really didn't know what _currentframe was before reading this, even if it is simple. I liked the way you wrote it too! Thanks

"just because idiots are great in number does not mean they're not idiots" - alicetheDroog

The Atheist Army|English Gentleman's Club

Sig censored by: SevenSeize

BBS Signature

Response to AS: _currentframe 2008-05-06 22:52:21

thanks I forgot how to write

_currentframe != w/e


Response to AS: _currentframe 2008-06-05 18:16:51

At 2/26/06 07:32 PM, TrueDarkness wrote: AS: Main

AS: _currentframe

Now, before we go any further let me clarify one thing.
Many people do not know the difference between = and ==
Well here is the difference between the two:
= is used to define something (i.e score=2, health=100, n00bs=1000 etc.)
== is used in everything else, mainly if statements(i.e if(score==2), if(health==100), if(n00bs==1000))

So now that that's cleared up we can finally move on...

How can this help me to make a game?

Let's see. The _currentframe property can be used to tell something to do something. For example:


That says that "if the Movie Clip 'enemy' is on frame 5, then the Movie Clip 'player' goes to the frame 'Pee_Pants' where in this case the player would be pissing his pants! har har har... anyway...

is there any way i could get an example fla. i keep trying stuff and nothing happens i think i am missunderstanding the whole thing and a little visual might help


BBS Signature

Response to AS: _currentframe 2008-06-05 18:20:03

At 6/5/08 06:18 PM, zrb wrote:
is there any way i could get an example fla. i keep trying stuff and nothing happens i think i am missunderstanding the whole thing and a little visual might help
Hmm, the topic is 4 years old. I don't think the poster is updating it anymore.

okay would you happen to be able to give an fla. to show a simple example of the _currentframe script?


BBS Signature

Response to AS: _currentframe 2008-06-05 18:37:48

_currentframe is just a property of any MovieClip.

It holds the current frame. It's no more complicated than that.


BBS Signature

Response to AS: _currentframe 2009-07-09 13:41:03

Thanks alot for this tutorial, it really helped me. I had no idea what _currentframe was but this really explained it and very well. I think we need detailed tutorials on basic AS because how else are noobs(like myself) mean to learn if all there is are advanced tutorials?

%u221A '09

BBS Signature

Response to AS: _currentframe 2009-07-22 00:23:30

At 2/26/06 07:32 PM, TrueDarkness wrote: AS: Main

AS: _currentframe

Hey man, i'm trying to build a side scrolling shooter game like alien hominid, megaman, metal slug, metroid, etc. and i keep running into the same frame count problem! My timeline is laid out like:

Main Timeline: mc with instance "guy"
Guy (all frames inside this mc have stop();) :
1) "stand" mc and frame
2) " run" mc and frame
3) "shoot" mc and frame
4) "roll" mc and frame

So far, i want the player:
- to move left and right and show the corresponding running animations while the left and right arrow keys are pressed.
- to roll when either one of the arrow keys AND the down arrow key are pressed
- to shoot (1 frame) when the shift key has been pressed
- to stay in an idle stance when no keys are being pressed

Here's my AS:

onClipEvent(enterFrame) {
xvel = 20;

if(Key.isDown(Key.RIGHT)) {
_root.guy._x += xvel;
stance == r;
this._xscale= 100
}else if(Key.isDown(Key.LEFT) ) {
_root.guy._x -= xvel;
this._xscale = -100;
stance == l;

if(Key.isDown(Key.SHIFT)) {


if(Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
this._x +=30

if(Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
this._x -= 30;

} if(runshoot._currentframe < 3) {


As you can see, the last IF statement's purpose is to ensure that the clip is played through, however, only the first frame is displayed...
I don't understand why it wont play all the frames for this movieclip because it works for the running animation which is 3 frames! I've been tinkering around with this and still dont understand why it wont work. this sh*t is WACK!
Help would be very much appreciated!!
PS: lol if im gettin owned somewhere in my AS logic! :P

Response to AS: _currentframe 2009-07-22 00:25:53

Never used this function before, but it's something i will be sure to use in the future. Thanks!

BBS Signature

Response to AS: _currentframe 2009-07-22 09:49:54

Thanks. This tutorial will help me a lot in my upcoming game

Response to AS: _currentframe 2011-06-24 07:39:44

this helped me a lot, so it's not useless. thanks for making this good and funny tutorial ^^

Response to AS: _currentframe 2018-07-13 02:04:22

You are awsome