Hello,
I want to change the color of a shape runtime.
But i can't get it to work...
(
See -- Added line
[From the Drag Me Sample]
--
local function onMouseDown(self, event)
if self:hitTestPoint(event.x, event.y) then
self.isFocus = true
self.x0 = event.x
self.y0 = event.y
-- Added line
self:setFillStyle(Shape.SOLID, 0xffff00, 1)
--
event:stopPropagation()
end
end
--
Can someone please help? O:-)
Comments
You have two options:
1. Create a white shape and change it's color by using Sprite:setColorTransform(r, g, b, a)
2. Clear the shape by using Shape:clear() and then reconstruct it again from the beginning with the new color.
Thanx for the quick reply!
How can i implement option 1 within the function onMouseDown(self, event)?
Sorry, a newbie..
For example you create a white rectange shape like:
Because shape is not available in onMouseDown.
Final question (for the day )
Can i also change the color of the line? (setLineStyle)