if (exp) { statements } • "conditional" statement • exp is an expression that returns true or false • if the expression returns true, the statements in the brackets are performed. if (Math.random()>.9) { gotoAndPlay(3); } • "Math" is an "object" –a collection of functions and variables • "random" is a function attached to "Math" –returns a number between 0 and 1 • .034754372, .73583728, .937862612 ... –different number every time |
More examples: art.umbc.edu peggysirota.com ryanSmithTHOTH |
box.buttonMode=true;
box.addEventListener(MouseEvent.CLICK, clickHandler);
box.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
box.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
function clickHandler(evt:Object):void {
trace("You just clicked me!");
}
function mouseOverHandler(evt:Object):void {
box.gotoAndPlay(2);
}
function mouseOutHandler(evt:Object):void {
box.gotoAndPlay(10);
}