The stage object is the root of the displaylist. It holds all displayObjects, that should be rendered to the screen. The stage itself is a displayObjectContainer, so it is possible to add and remove displayObjects to it.

The stage handels mainly the render process and interaction model. Every displayObject we added to the stage will be part of the render process.

Adding one component:

Button* button = new Button();
_stage->addChild( button);

We can easily create hierarchies by using DisplayObjectContainer objects.

DisplayObjectContainer* displayObjectContainer = new DisplayObjectContainer();
displayObjectContainer->addChild(button1);
displayObjectContainer->addChild(button2);

_stage->addChild(displayObjectContainer);

Removing components:

displayObjectContainer->removeChild(button1);
displayObjectContainer->removeChild(button2);
_stage->removeChild( button);

Last edited Mar 27, 2013 at 11:22 PM by TypeOverride, version 7

Comments

No comments yet.