Bjorn Schultheiss wrote:
Hey Guys, check this out


Var clickHandler:Function = MyClass.staticMethod;
var args:Array = ['Can', 'pass', 'in', 'any', 'amount'];
newBtn.addEventListener("click", Delegate.create(this, function(evt:Object,
meth:Function, args:Array) { meth.apply(null, args) }, clickHandler, args )
);
That is a good idea! I just tried one of simpler layout (at least to me in terms of what I understand in AS) .... works like a charm:

import utils.Delegate;
//Create array to pass multiple args in - both string and number for testing
var aMyArgs:Array = [1, 2, 'three', 4];
//use the delegate
this.menuBtn.addEventListener("click", Delegate.create(this, onHit1, aMyArgs));
//create the btn event to handle the click
function onHit1(o:Object, n:Array)
{
   for (i = 0; i < n.length; i++)
   {
   trace("it was hit with the arg: " + n[i]);
   }
}

This is VERY handy (well to me anyways) to be able to pass in what ever args I need to.

d


_______________________________________________
Flashcoders@chattyfig.figleaf.com
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