On 6/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Alot of people complain that you can't pass parameters with delegate. Well
you can, a multiple of ways, and if you structure your code with some
forethought, you can have it pass params if you are delegating a function
structured do so.

Alternatively you could use (or write, as I did) a slightly more
advanced version of Delegate which takes function passing into
account.

A couple of popular variants are:

http://www.dynamicflash.co.uk/2005/02/delegate-class-refined/

and

http://www.person13.com/articles/proxy/Proxy.htm

They let you write things like:

myButton1.onRelease=Delegate.create(this,onSomeButtonPressed,"green");
myButton2.onRelease=Delegate.create(this,onSomeButtonPressed,"red");

:

function onSomeButtonPressed(colour:String)
{
  trace("The "+red+" button was pressed!");
}

and also to pass additional parameters to existing callback function.

HTH,
 Ian
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to