Flash function ( )
At first glance, making functions in Flash is essentially simple, but there is much more than meets the eye. Let’s look at just how functions function…
Currently this article is just an outline, but will cover:
- myFunction = function(){} vs. function myFunction(){}
Built-in, top-level, named, literal, constructor, _global, anonymous and callback functions - function () { return val; }
- onEnterFrame = function vs. onEnterFrame = function(){ return function(){}; }
- function(){ trace ( arguments ) }
- Accessing functions with Strings and the Array operator: scope [ “functionName” ]( prams )
- Function.apply ( scope, [pram1, pram2, pram3] ) vs. Function.call ( scope, pram1, pram2, pram3 )
- arguments.callee, arguments.caller, arguments [ 0 ]
- function variables
- Scope chain of variables as it relates to functions vs. timeline variables
- mx.utils.Delegate as a function wrapper and alternative custom Delegate classes
- Using the Delegate to proxy events using Event Dispatcher
- Memory leaks and clean-up when proxying events using Delegates
- Class Methods - Public, Private, Static
- Class Methods - getters / setters
» Permalink » del.icio.us » Digg It!

jgraup said,
February 17, 2007 @ 9:34 pm
GET / SET’No-brain’ getter and setters
http://www.darronschall.com/weblog/archives/000071.cfm
ActionScript 2: Why set calls get
http://www.darronschall.com/weblog/archives/000071.cfm
get - Adobe
http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00001357.html
jgraup said,
February 17, 2007 @ 11:02 pm
SCOPE
When this isn’t this… - Darron Schall - this example
http://www.darronschall.com/weblog/archives/000134.cfm
jgraup said,
February 17, 2007 @ 11:03 pm
CALL / Apply
call - Adobe
http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00001357.html
apply - Adobe
http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00001357.html
jgraup said,
February 17, 2007 @ 11:03 pm
TECHNIQUES
Making Functions More Modular - Kirupa
http://www.kirupa.com/developer/actionscript/modular.htm
jgraup said,
February 17, 2007 @ 11:13 pm
INLINE / ANONYMOUS / NAMED FUNCTIONS
Anonymous, inline, and named functions in ActionScript - Darron Schall
http://www.darronschall.com/weblog/archives/000125.cfm
jgraup said,
February 17, 2007 @ 11:37 pm
METHOD OVERLOADING
Method Overloading in ActionScript 2 - Darron Schall
http://www.darronschall.com/weblog/archives/000051.cfm
jgraup said,
February 17, 2007 @ 11:38 pm
PROTOTYPE
AS 2.0
Object.prototype.someMethod - Darron Schall
http://www.darronschall.com/weblog/archives/000051.cfm
AS 1.0
PROTOTYPE = new methodsForBuiltInObjects(); - Layer51
http://proto.layer51.com/default.aspx
OOP with AS1 officially deprecated - Darron Schall
http://www.darronschall.com/weblog/archives/000073.cfm
Making the Prototype Work - Kirupa
http://www.kirupa.com/developer/actionscript/spring2.htm
Examples
MovieClip._location property - Darron Schall - Using ASSetPropFlags
http://www.darronschall.com/weblog/archives/000081.cfm
jgraup said,
February 21, 2007 @ 4:51 pm
ARGUMENTS.CALLER / ARGUMENTS.CALLEE
{
     // simple trace
     trace( ‘func - toRun: ’ + toRun )
     // this function
     trace( arguments.callee )
     // function that called this function
     trace( arguments.caller )
     // did this function call this function
     trace( ‘called from func: ’ + (arguments.caller == arguments.callee) + newline )
     // run this again if toRun is set to true
     if ( toRun )  arguments.callee ( false );
}
func ( true ); // run func from this
/*
     /// TRACE OUTPUTS
     func - toRun: true
     [type Function]
     null
     called from func: false
     func - toRun: false
     [type Function]
     [type Function]
     called from func: true
*/
function anotherFunc ( )
{
     func ( true ); // run func from anotherFunc
}
anotherFunc ( ); // run anotherFunc from this
/*
     /// TRACE OUTPUTS
     func - toRun: true
     [type Function]
     [type Function]
     called from func: false
     func - toRun: false
     [type Function]
     [type Function]
     called from func: true
*/