| Example |
var btn = pseudo.RadioButton.create(this, "btn", 1);
btn.setSize(100, 20);
//Apply the skin to the button
btn.setLook(pseudo.look.XPLook.getInstance());
//Here we add a label to the button, what is a little bit tricky
var lbl:pseudo.Label = pseudo.Label(btn.addItem(pseudo.Label));
lbl.setAlign("center");
lbl.setText("Button one");
//set the radio buttons group name
btn.setGroupName("group")
//Add a listener to the button
var args:Object = new Object();
args.text = "doubleClick event was invoked for btn";
btn.addListener("doubleClick", this, onDoSomething, args);
//Calling these functions will finally draw the component
btn.update();
btn.draw();
//add a second button
var btn2 = pseudo.RadioButton.create(this, "btn2", 2);
btn2.setSize(100, 20);
//Apply the skin to the button
btn2.setLook(pseudo.look.XPLook.getInstance());
//Here we add a label to the button, what is a little bit tricky
var lbl:pseudo.Label = pseudo.Label(btn2.addItem(pseudo.Label));
lbl.setAlign("center");
lbl.setText("Button two");
btn2.setGroupName("group")
//Position the second button
btn2._y = btn._y + 30;
//Add a listener to the button
var args2:Object = new Object();
args2.text = "doubleClick event was invoked for btn2";
btn2.addListener("doubleClick", this, onDoSomething, args2);
//Calling these functions will finally draw the component
btn2.update();
btn2.draw();
//add a third button
var btn3 = pseudo.RadioButton.create(this, "btn3", 3);
btn3.setSize(100, 20);
//Apply the skin to the button
btn3.setLook(pseudo.look.XPLook.getInstance());
//Here we add a label to the button, what is a little bit tricky
var lbl:pseudo.Label = pseudo.Label(btn3.addItem(pseudo.Label));
lbl.setAlign("center");
lbl.setText("Button three");
btn3.setGroupName("group")
//Position the second button
btn3._y = btn2._y + 30;
//Calling these functions will finally draw the component
btn3.update();
btn3.draw();
//Add a listener to the button
var args3:Object = new Object();
args3.text = "mouseRelease event was invoked for btn 3";
btn3.addListener("doubleClick", this, onDoSomething, args3);
//set the first button selected
btn.setState("sunken");
//Some function to handle the event
function onDoSomething(args:Object):Void
{
trace(args.text);
}
// This code will draw the buttons using XP look and feel skin.
// Please notice that you should always use some skin to create the component,
// this can be done like in this example, and the skin will be complied into the swf file,
// or you can use another technique and load the skin at a run time.
|