Monday, April 9, 2012

functions, methods, parameters

functions
functions are blocks of code that allow us the create situations for executing methods based on events on the stage, such as interactivity, like clicking a button
braces { } allow the function to trigger when called by name


methods
methods are the verbs of actionScript
in a function, the methods tell FLASH what to do, for example stop() or gotoAndPlay()

parameters
methods are followed by parentheses; inside these parentheses are values call parameters
parameters specify the activity of the method, for example assigning a frame destination or a type of event listener:
in the method gotoAndPlay(5), 5 is the parameter


methods
btnInstanceName.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandlerA);
function mouseDownHandlerA(event:MouseEvent):void {
gotoAndStop(1);
}

parameters
btnInstanceName.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandlerA);
function mouseDownHandlerA(event:MouseEvent):void {
gotoAndStop(1);
}

No comments:

Post a Comment