Conditional Statements

How to create basic AI in Action Script

This week, we will explore if / else statements to check for certain conditions to be met before performing an action.

FRAMES

// stops the animation

stop();

// goes to frame number in parenthesis and plays

gotoAndPlay();

// goes to frame number in parenthesis and stops

gotoAndStop();

//goes to previous frame

mcNumbers.gotoAndStop(mcNumbers._currentframe - 1);

//goes to next frame

mcNumbers.gotoAndStop(mcNumbers._currentframe + 1);

//go in a loop

mcNext.onPress = function() {

if (mcNumbers._currentframe == 4) {

   mcNumbers.gotoAndStop(1);

}

else {

   mcNumbers.gotoAndStop(mcNumbers._currentframe +1);

   }

}

Questions?

As always, please email me if you have any questions! jearley1@ivytech.edu