Ramon Miguel M. Tayag wrote:
I don't think you can create dynamic functions.. even if you could, I
don't see the need to.

use your arguments to make your functions all-purpose.

Ex.

function onBtnPress(n:Number):Void
{
 trace(n + " was pressed.");
}

button0.onRelease = Delegate.create(this, onBtnPress, 0);
button1.onRelease = Delegate.create(this, onBtnPress, 1);



Ah! I never knew you could throw args like that to your functions through delegate

Sweet!


That totally makes more sense!

Now my next question....

Say for example I needed to throw a different arg to that function?

IE this time I needed one var, and later I needed another?

var nMyNum:Number = 0;

button0.onRelease = Delegate.create(this, onBtnPress, nMyNum);

nMyNum = 10;

//need to update the delegate here
//button0.onRelease = Delegate.create(this, onBtnPress, nMyNum);

Can you remove or overwrite delegate instances?



--
dnk

_______________________________________________
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