hi all and thanks in advance,

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

listener:Function — The listener function that processes the event. 
This function must accept an Event object as its only parameter and 
must return nothing, as this example shows: 
function(evt:Event):void

It seems that it is impossible to send information via the 
addEventListener as a parameter or a packed ID name, etc. 

Anyone have an idea on how to dynamically build buttons and pass 
info on to a click event?  Here is my code so far.  Comments 
included to help debug....
***********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;
 //tried to pack the info into the button ID property, no worky
   btn.id = "MLSE" + arrSection[i].MLSEID; 
 //tried to send info as a parameter in the function, no worky
   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.  
     Alert.show ();
    }
*********END OF CODE***********  

thanks again,
Aaron





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to