Prev | Current Page 707 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

They differ more in their context and render behaviors.
Part II: Server Side, JavaScript, and Flash: Oh My!
376
Wiring events to controls is as simple as in the following example:
var button = new Button(???Button Label???);
button.mouse.click.addHandler(function(e) { trace(???I??™ve been clicked! ???); });
Figure 13 - 2 shows the three controls as rendered by the Flash 9 implementation.
Figure 13 - 2
import ui.controls.Button;
import ui.controls.Label;
import ui.controls.TextBox;
import ui.containers.GridLayout;
import ui.flash9.StageView;
class Main
{
public static function main()
{
var view = new StageView();
var grid = new GridLayout(1, 3);
grid.setElement(new Button(???Button???), 0, 0);
grid.setElement(new TextBox(???Text Box???), 0, 1);
grid.setElement(new Label(???Label???), 0, 2);
view.addChild(grid);
view.render();
}
}
Containers
The containers are classes that contain and arrange child controls. By default the hLayout and vLayout
variables of all the containers are both set automatically to Margins(0) .


Pages:
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719