Err, that last function should probably be called "onButtonRelease" ... but you get the idea....
― Mike Keesey > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:flashcoders- > [EMAIL PROTECTED] On Behalf Of Mike Keesey > Sent: Monday, October 30, 2006 5:04 PM > To: 'Flashcoders mailing list' > Subject: RE: [Flashcoders] AS 3 -> event args > > Here's an example: > > ---mypackage/IndexButton.as--- > package mypackage { > public class IndexButton extends Button { > function IndexButton() { > super(); > } > public function get index():uint { > return _index; > } > public function set index(value:uint):void { > _index = value; > } > protected var _index:uint; > } > } > ---in some other class--- > //... > protected function init():void { > for each (var button:IndexButton in this) { > button.addEventListener("release", > onButtonPressed); > } > } > protected function onButtonPressed(event:Event):void { > if (event.target is IndexButton) { > var index:uint = > IndexButton(event.target).index; > // Do something with index. > } > } > //... > > ― > Mike Keesey > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:flashcoders- > > [EMAIL PROTECTED] On Behalf Of Bbt Lists > > Sent: Monday, October 30, 2006 4:44 PM > > To: Flashcoders mailing list > > Subject: Re: [Flashcoders] AS 3 -> event args > > > > Mike Keesey wrote: > > > One way would be to create a subclass of Event that stores the > > > parameters. > > > > > > In this case, though, I wouldn't even do that. You can just use > > > event.target to determine which button was pressed: > > > > > > function onPressed(event:Event):void { > > > var button:Button = Button(event.target); > > > // Do stuff with button. > > > } > > > > > > If you need to specifically use an index number, I'd attach that to > the > > > button instances themselves. Then you could retrieve that via > > > event.target. > > > ― > > > Mike Keesey > > > > > > > > With the way I do intend to use it, I would have to pass an index as > > that index provides the basis for many actions within the onPressed > > function. And I am not sure what you mean by attaching the button > > instance itself... how would one go about that? > > > > > > > > -- > > 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 > > _______________________________________________ > 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