| Example |
//create pseudo.ScrollBar instance
var scroll:pseudo.ScrollBar = pseudo.ScrollBar.create(this, "scroll", 1);
//set scroll movie clip size
scroll.setSize(15, 100);
//initialize scroll instance with some data
scroll.setRange(0, 130);
scroll.setPos(15);
scroll.setScrollSize(30);
scroll.setSmallScroll(1);
//add some listener of the "changePos" event
scroll.addListener("changePos", _root, _root.onChangedScroll);
//Apply the skin to the scroll
scroll.setLook(pseudo.look.XPLook.getInstance());
//Calling these functions will finally draw the component
scroll.update();
scroll.draw();
//Create a label to display changes that happen with the scroll
var lbl:pseudo.Label = pseudo.Label.create(_root, "lbl", 2);
lbl.setLook(pseudo.look.StdLook.getInstance());
lbl.setAutoSize(true);
//Set some default text
lbl.setText("drag scroll");
lbl.update();
lbl.draw();
lbl._x = scroll._x + scroll.getW() + 10;
//Some function to handle the "changePos" event
function onChangedScroll():Void
{
lbl.setText(String(scroll.getPos()));
lbl.update();
lbl.draw();
}
// This code will draw the scroll bar 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.
|