Friday, December 7, 2012

Function statement

Function statements are the preferred technique for defining functions in strict mode. A function statement begins with the function keyword, followed by:
  • the function name;
  • the parameters, in a comma-delimited list enclosed in parentheses;
  • the function body, that is, the ActionScript code to be executed when the function is invoked, enclosed in curly braces.
For example, the following code creates a function that places the parameter into a trace() statement and invokes the function using the string hello as a parameter:
function traceParameter(aParam:String) {
     trace(aParam);
}
traceParameter("hello"); // Output: hello

Programming Actionscript 3. Powered by Blogger.