I didn't really read the webpage, but you can't tack on a variable I'm pretty sure. To tack something on, the class needs to be dynamic, which an Object class is, but a MovieClip or Sprite class isn't. So unless you're caller is something you extended from a movieclip or sprite and made dynamic, you won't be tacking anything on.
I think I'm right, I'm pretty sure I tried!

Delegate is still kinda useful. I've been trying to get by without it since I'm still learning, but the way I've been doing things without it is to dispatch customized events that have specific parameters. It's kind of a pain in the butt though, say if you want to pass a parameter along with your mouseclick. Since you can't control how a mouseclick is dispatched, you have to make a class to listen for a mouseclick, and then listen to the custom dispatched event from that class.

At least this is how I've been doing things so far!
ben

Merrill, Jason wrote:
However, in AS 2 to tack on variables, I did/do it differently:

var myDel:Object = myButton.onRelease = Delegate.create(this,
doFunction)
myDel.fruit = "pineapple";

function doFunction():Void
{
        trace(arugments.caller.fruit)
}
I assumed in AS3 you could do something similar, though I don't know, I
haven't tried yet:

var myObj:Object = myButton.onRelease = doFunction
myObj.fruit = "pineapple";

function doFunction():Void
{
        trace(arugments.caller.fruit)
}
Or no?  I kinda doubt you have to do it the way you posted on your blog,
but I don't know for sure.  If you do, that really sucks.


Jason Merrill
Bank of America GT&O Learning & Leadership Development
eTools & Multimedia Team


_______________________________________________
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