| Example |
// Create an instance of the skin look
var look:Object = pseudo.look.AquaLook.getInstance();
//Create an instance of the Knob component
knob = pseudo.Knob.create(_root, "knob", 1);
//apply the slin to the Knob instance
knob.setLook(look);
knob.setSize(60, 60);
//add listener of the "changed" to the
knob.addListener("changed", this, onChanged);
knob.update();
knob.draw();
//
btnRadial = pseudo.RadioButton.create(_root, "btnRadial", 2);
var lbl:pseudo.Label = pseudo.Label(btnRadial.addItem(pseudo.Label));
lbl.setText("Radial");
lbl.setAlign("center");
btnRadial.addListener("mouseRelease", this, onChangeRot, 2);
btnRadial.setLook(look);
btnRadial.setSize(70, 24);
btnRadial.update();
btnRadial.draw();
//Create three buttons to change rotation type
btnVert = pseudo.RadioButton.create(_root, "btnVert", 3);
lbl = pseudo.Label(btnVert.addItem(pseudo.Label));
lbl.setText("Vert");
lbl.setAlign("center");
btnVert.addListener("mouseRelease", this, onChangeRot, 0);
btnVert.setLook(look);
btnVert.setSize(70, 24);
btnVert.update();
btnVert.draw();
btnVert._y = btnRadial._y + btnRadial.getH() + 5;
btnHorz = pseudo.RadioButton.create(_root, "btnHorz", 4);
lbl = pseudo.Label(btnHorz.addItem(pseudo.Label));
lbl.setText("Horz");
lbl.setAlign("center");
btnHorz.addListener("mouseRelease", this, onChangeRot, 1);
btnHorz.setLook(look);
btnHorz.setSize(70, 24);
btnHorz.update();
btnHorz.draw();
btnHorz._y = btnVert._y + btnVert.getH() + 5;
btnRadial.setState("sunken");
//create a field to diplay the value ot the knob
lblPos = pseudo.Label.create(_root, "lblPos", 5);
lblPos._y = btnHorz._y + btnHorz.getH() + 5;
lblPos._x = 10;
lblPos.setLook(look);
lblPos.setSize(50, 23);
lblPos.getData().type = "edit";
lblPos.setText("0");
lblPos.update();
lblPos.draw();
Stage.addListener(this);
onResize();
//Function to handle "changed" event
function onChanged():Void
{
lblPos.setText(String(knob.getPos()));
lblPos.update();
lblPos.draw();
}
function onResize():Void
{
knob._x = Math.round((Stage.width - 40) / 2);
knob._y = Math.round((Stage.height - 40) / 2);
}
//Function to change the knob rotation type
function onChangeRot(val:Number):Void
{
knob.setRotType(val);
}
|