Sprite:updateStyle

From GiderosMobile

Available since: Gideros 2024.11.1
Class: Sprite

Description

Performs what need to be done when the style table of a Sprite has changed. It is called automatically by Gideros or when application:applyStyles() is called. The method can be overriden by your own classes if needed so it is lua visible.

Sprite:updateStyle()

Example

local style={
	cellColor=vector(1,0,0,1) --cellColor is Red initially
}
for i=1,10 do
	local p=Pixel.new(vector(0,0,0,0),10,10)	
	p:setX((i-1)*15)
	p:setStyle(style)
	p:setColor("cellColor")
	stage:addChild(p)
end
Core.asyncCall(function()
	Core.yield(3) --Wait 3s
	style.cellColor=vector(0,1,0,1) --Set cellColor to green
	for i=1,10 do
		stage:getChildAt(i):setStyle(style)
		stage:getChildAt(i):updateStyle() -- already automatic
	end
end)