Below is my test class of trying to pragmatically add a set of radio buttons to an ActionScript 3.0 project. Do you see anything I may have done incorrectly? When I run it, I don't get any compile errors but I also don't see any radio buttons.

-- James


package
{
  import flash.display.Sprite;
  import flash.events.MouseEvent;
  import mx.controls.RadioButton;
  import mx.controls.RadioButtonGroup;

  public class TestRadioGroup extends Sprite
  {
    private var _group:RadioButtonGroup;
    private var _radio1:RadioButton;
    private var _radio2:RadioButton;

    public function TestRadioGroup()
    {
      // radio group
      _group = new RadioButtonGroup();
      _group.addEventListener(MouseEvent.CLICK, onRadioClick);          
      // first radio
      _radio1 = new RadioButton();
      _radio1.label = "One";
      _radio1.group = _group;
      addChild(_radio1);
      // second radio
      _radio2 = new RadioButton();
      _radio2.label = "Two";
      _radio2.group = _group;   
      addChild(_radio2);
    }
    public function onRadioClick(event:MouseEvent):void
    {
      var rbg:RadioButtonGroup = (event.target as RadioButtonGroup);
      trace (rbg.selection);
    }
  }
}




T. Michael Keesey wrote:
Where is this code placed?

On 2/13/07, August Gresens <[EMAIL PROTECTED]> wrote:

Hello

I'm trying to use an mx.controls.TextArea in my ActionScript 3.0 project.

var textArea:TextArea = new TextArea();
textArea.text = "foo";
addChild(textArea);

Nothing shows up - I suspect there is more to using flex controls in an AS3
project.

Can anyone point me to some info about this?

Thanks,

August

_______________________________________________
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