If you're already using a custom Delegate, why not modify the thing to
handle what you've just provided?

var clickHandler:Function = MyClass.staticMethod;
var args:Array = ['Can', 'pass', 'in', 'any', 'amount'];
newBtn.addEventListener("click", Delegate.create2(this, clickHandler, args
));
// (I'm sure you could think of a better name than 'create2' though)

that's all a Delegate is doing is an apply. It's not magic, not really.

Tyler

On 8/13/06, Bjorn Schultheiss <[EMAIL PROTECTED]> 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
)
);



Regards,

Bjorn Schultheiss
Senior Flash Developer
QDC Technologies

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of dnk
Sent: Monday, 14 August 2006 5:17 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] |:::| can you write dynamic meathods in a
class?

Ramon Miguel M. Tayag wrote:
> Sometimes some events pass their own args and you dont even see them..
>
> Try changing your function to this:
>
> function onHit1(o:Object, n:Number) //the o object is passed by the
> listener {
>    trace("it was hit with the number: " + n); }
>
That worked perfect!!!!!!!


Thanks sooo much!

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
_______________________________________________
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

_______________________________________________
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