In the example below, line:append will not draw until after the touch event has ended, and will not draw at all if the line.width is set before any of the line:append calls.
[code]
local line
function drawLine(event)
if event.phase == ‘began’ then
if line ~= nil then
line:removeSelf()
line = nil
end
line = display.newLine( event.xStart, event.yStart, event.x, event.y )
elseif event.phase == ‘moved’ then
line:append( event.x, event.y )
line:setColor( 155,228,255 )
elseif event.phase == ‘ended’ then
line.width=5
end
end
Runtime:addEventListener( “touch”, drawLine )
[/code] [import]uid: 4596 topic_id: 7995 reply_id: 307995[/import]