Tim
On 7/14/06,
meathead <[EMAIL PROTECTED]> wrote:
Thanks a bunch. This totally works. Boy, was I ever going down the
wrong path.
Here's my working code in case any other newbie comes accross this.
********CODE**********
// so far I've set up an array to return data from XML and am
//looping thru adding buttons where needed.
if(arrSection[i].MLSEID != null) {
var btn:Button = new Button()
btn.label = "MLSE Info";
btn.x = intX;//I'm adding a 'prefix' to the button id because there will be other
//buttons I'm adding and theroretically the same ID could be used.
btn.id = "MLSE" + arrSection[i].MLSEID;btn.addEventListener(MouseEvent.CLICK, ShowMessage);
btn.y = intY;
can.addChild(btn);
intY += 30;
}
public function ShowMessage(event:Event):void
{
//this is just a test to see if I can pass info.//Parsing and further coding would happen here.
Alert.show (event.currentTarget.id);
}
*******END OF CODE**********
Just to note, the Flex builder intelisense will not pick up the
button properties.
Thanks,
Aaron
--- In flexcoders@yahoogroups.com, Tom Chiverton <tom.chiverton @...>
wrote:
>
> On Wednesday 12 July 2006 22:13, meathead wrote:
> > So I'm setting up buttons on the fly via actionscript and I want
to
> > pass an ID number based on which button was selected. I was
going
> > to use an addEventListener for the click event of the newly
created
> > button, but then I saw this on the live docs
>
> Set the name of the button to the id, and look in
event.currentTarget in you
> event handler.
>
> --
> Tom Chiverton
>
> ****************************************************
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
- [flexcoders] Re: Pass a parameter in the event function of an... meathead
- Re: [flexcoders] Re: Pass a parameter in the event funct... Tim Scollick
Reply via email to