Prev | Current Page 715 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

addChild(new FieldLayout(fldw, ???Branches:???,
new FieldLayout(txtw, ???qt???, branches,Right)));
panel.addChild(new FieldLayout(150, ???Color:???,
new FieldLayout(120, ???hex???,bcolor, Right)));
var gbtn = new Button(???Generate???);
gbtn.hLayout = Margins(0, 0);
gbtn.vLayout = Measures(0, 60, 0);
Chapter 13: Replacing the Need for an IDE
383
gbtn.mouse.click.addHandler(generateTree);
panel.addChild(gbtn);
var cbtn = new Button(???Clear???);
cbtn.hLayout = Margins(0, 0);
cbtn.mouse.click.addHandler(clear);
panel.addChild(cbtn);
view.render();
}
private function generateTree(e)
{
var s = flash.Lib.current.stage;
var tree = new Tree(flash.Lib.current.graphics);
tree.angle = getAngle(bangle, 25);
tree.branches = getInt(branches, 3, 1, 10);
tree.color = getInt(bcolor, 0x000000, 0x000000, 0xffffff);
//x, y, len, angle, width
tree.generate(s.stageWidth/2-105, s.stageHeight,
getInt(blength, 80, 10, 200), Angle.NORTH, getInt(bwidth, 8, 2, 16));
}
private function getInt(el : TextBox, alt : Int, min : Int, max : Int) : Int
{
var v = Std.


Pages:
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727