2 Replies Latest reply on Nov 9, 2010 3:00 PM by mattcom

    AddChild Button

    mattcom Level 1

      This is probably something very simple but I can't find anything on it.  So I would appreciate any insight you may have.


      It's a very simple program that is dynamically creating buttons at runtime based on XML data which will eventually get served by a database query.


      Problem:  I can't seem to add a newButton.click = clickHandler() type function through the process of addChild.  Any suggestions?






      import mx.controls.Alert;


      import mx.controls.Button;





      var buttons:XML =


      <Button label="Yes" link="http://papajohns.com"/>

      <Button label="No" link="http://google.com"/>



      private function makeButtons():void {


      for each ( var button : XML in buttons.Button )



      var newButton:Button = new Button();


      //Modify Properties

      newButton.label = button.@label;



      //Add the new button to the stage (Screen)