flash on 2010-9-16

by felixpaq
♥0 | Line 30 | Modified 2010-09-16 22:56:52 | MIT License
play

ActionScript3 source code

/**
 * Copyright felixpaq ( http://wonderfl.net/user/felixpaq )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/9JEc
 */

package {
    import fl.controls.RadioButton;
import fl.controls.RadioButtonGroup;

var rbg1:RadioButtonGroup = new RadioButtonGroup("group1");
var rbg2:RadioButtonGroup = new RadioButtonGroup("group2");

var rb1:RadioButton = new RadioButton();
var rb2:RadioButton = new RadioButton();
var rb3:RadioButton = new RadioButton();
var rb4:RadioButton = new RadioButton();
rb1.addEventListener(MouseEvent.CLICK, announceGroup);
rb2.addEventListener(MouseEvent.CLICK, announceGroup);
rb3.addEventListener(MouseEvent.CLICK, announceGroup);
rb4.addEventListener(MouseEvent.CLICK, announceGroup);
rb1.group = 
rb2.group = rbg1;
rb3.group =
rb4.group = rbg2;
rb1.move(10,10);
rb2.move(10,50);
rb3.move(150,10);
rb4.move(150,50);

addChild(rb1);
addChild(rb2);
addChild(rb3);
addChild(rb4);

function announceGroup(e:MouseEvent):void {
    var rb:RadioButton = e.target as RadioButton;
    trace(rb.groupName);
}
}