Adobe Flash Platform Flashcards
are blocks of code that carry out specific tasks and can be reused in your program.
Functions
A function is called a _ if you define it as part of a class definition or attach it to an instance of an object. A function is called a _ if it is defined in any other way.
method, function closure
You call a function by using its identifier followed by the parentheses operator (()).
calling function
You use the _ to enclose any function parameters you want to send to the function.
parentheses operator
use the Math.random() method, which takes no parameters, to generate a random number:
var randomNum:Number = Math.random();
Define your functions with _ if you prefer static, or strict mode, programming.
function statements
Define your functions with _ if you have a specific need to do so; are more often used in dynamic, or standard mode, programming.
function expressions
A function statement begins with the _, followed by:
The function name
function keyword
The _, in a comma-delimited list enclosed in parentheses
parameters
The _—that is, the ActionScript code to be executed when the function is called, enclosed in curly brackets
function body
the following code creates a function that defines a parameter and then calls the function using the string “ hello” as the parameter value:
function traceParameter(aParam:String) { trace(aParam); } traceParameter("hello"); // hello
The second way to declare a function is to use an assignment statement with a function expression, which is also sometimes called a _ or an _. This is a more verbose method that is widely used in earlier versions of ActionScript.
function literal, anonymous function
An _ with a function expression begins with the var keyword
assignment statement
Mouse events such as a button click, double-click, or simply moving the mouse are handled by the _.
MouseEvent class
Since the _ is one of the primary means through which a user interacts with a Flash movie, it’s important to understand how to listen and respond to mouse events.
mouse
The simplest event is the _, which happens when the user presses and then releases the mouse button.
button click,
You can detect and respond to a button click by first attaching a listener to the _ (referred to as stage) and using the property MouseEvent.CLICK as follows:
main Stage
If you want to detect a click on a particular object, use the _ instead of the word stage.
object’s name
Flash can listen for a mouse event on any object of the _ displayed on the Stage
InteractiveObject class
Happens when the mouse button is clicked
click
Happens when the mouse button is clicked twice in rapid succession
double_click
Happens when the mouse pointer moves
mouse_move
Happens when the mouse button is pressed
mouse_down
Happens when the mouse button is released
mouse_up
Happens when the mouse moves from a nontarget area over a target area
mouse_over
Happens when the mouse moves from a target area out of the target area
MOUSE_OUT
Happens when the mouse wheel is rotated
MOUSE_WHEEL
The _ requires an additional bit of code to work properly
MouseEvent.DOUBLE_CLICK
The property _ for the button instance must be set to true for double-click events to be captured.
doubleClickEnabled
instead of MouseEvent.CLICK, you can use _
“click”
instead of MouseEvent.MOUSE_UP, you can use _
“mouseUp”.
Check the _ for the full list of shortcuts.
Flash Help Action-Script Language Reference
features of programming languages that tell the computer to execute certain actions, provided certain conditions are met.
Conditional statements, expressions, or simply conditionals
_ are used through the various programming languages to instruct the computer on the decision to make when given some conditions. These decisions are made if and only if the pre-stated conditions are either true or false, depending on the functions the programmer has in mind.
Conditional statements
The _ allows you to test a condition and execute a block of code if that condition exists, or execute an alternative block of code if the condition does not exist.
if..else conditional statement
the following code tests whether the value of x exceeds 20, generates a trace() function if it does, or generates a different trace() function if it does not:
if (x > 20) { trace("x is > 20"); } else { trace("x is <= 20"); }
You can test for more than one condition using the _ conditional statement.
if..else if
If an if or else statement is followed by only one statement, the statement does not need to be enclosed in _
curly brackets
The _ is useful if you have several execution paths that depend on the same condition expression. It provides functionality similar to a long series of if..else if statements, but is somewhat easier to read.
switch statement
Instead of testing a condition for a _, the switch statement evaluates an expression and uses the result to determine which block of code to execute.
Boolean value
Blocks of code begin with a _ statement and end with a _ statement.
case, break