The Stage

From GiderosMobile
Revision as of 20:18, 10 September 2018 by Anthony (talk | contribs) (Created page with "The scene tree is the hierarchy of all graphical objects currently displayed and this hierarchy needs a root. The root of the scene tree is an instance of the Stage class whic...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The scene tree is the hierarchy of all graphical objects currently displayed and this hierarchy needs a root. The root of the scene tree is an instance of the Stage class which is automatically created and set as a global variable when Gideros starts. You can access this global variable with the name stage.

When Gideros starts, the display list hierarchy contains one item (the global Stage instance) only and we can add more:

- Create a Sprite object

local mySprite = Sprite.new()

- Add this sprite to the stage:

stage:addChild(mySprite)