Event.ADDED TO STAGE

From GiderosMobile
Revision as of 21:11, 29 June 2024 by MoKaLux (talk | contribs)

Available since: Gideros 2011.6
Value: addedToStage
Defined by: Sprite

Description

This event is dispatched when an object is added to the stage hierarchy.

Example

MySprite = gideros.class(Sprite)
function MySprite:init()
	self:addEventListener(Event.ADDED_TO_STAGE, self.onAddedToStage, self)
	self:addEventListener(Event.REMOVED_FROM_STAGE, self.onRemovedFromStage, self)
end
function MySprite:onAddedToStage(event)
	self:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self)
end
function MySprite:onRemovedFromStage(event)
	self:removeEventListener(Event.ENTER_FRAME, self.onEnterFrame, self)
end
function MySprite:onEnterFrame(event)
	-- enter frame logic
end