As3 frame handling

2 posts

Flag Post

I feel really stupid for asking this but because I’ve been always making games with simple shapes like boxes I’ve never practiced it.

Basically how do you control frames in as3 ? (external classes) you don’t have to get into detail just the general way to do it. I want to know how to:
make it so it goes to a “stand” animation if its not doing anything
run animation loops for things like running
and any tips on avoiding conflict between in hiearchy.

 
Flag Post
// in the class that extends movie clip

private const
STAND:int= frame where it stands,
RUN_FIRST:int= first frame where it runs,
RUN_LAST:int= last frame of running animation;

public function run():void{
if(running){ //check if currentFrame is in range of the running animation
if(currentFrame<RUN_LAST)nextFrame();
else gotoAndStop(RUN_FIRST);
}
else gotoAndStop(RUN_FIRST);
}

public function doNothing():void{
if(currentFrame!=STAND)gotoAndStop(STAND);
}

Then the class that controls the instance of the movie clip just tells it what to do based on keyboard / mouse events or whatever.

I didn’t get the hierarchy part.