Hi folks,
I create a displayobject on a touch event and give it a transition. The transition has an onComplete function as a param. I know that this fucntion is called but I can not figure out how to retrieve the displayobject inide that function so I can do things to it further. How to retrieve this object correctly?
The two functions look like:
-- Function to be fired, once the transition is done
local function complete( event )
local ts = event.target
local params = { time = 500 , alpha = 0.0 }
--display.getCurrentStage():setFocus( ts )
transition.to (ts, params )
count = 0
end
-- Touch handler function
local function printTouch2( event )
print( "event(" .. event.phase .. ") ("..event.x..","..event.y..")" )
if "began" == event.phase then
local params = { time=500, x= event.x, y=event.y, onComplete=complete }
local sprShoot = display.newImage("shoot2.png")
sprShoot.xScale = 0.5
sprShoot.yScale = 0.5
sprShoot.x = sprCanon.x
sprShoot.y = sprCanon.y-20
transition.to (sprShoot, params)
--sprShoot:addEventListener( "onComplete", complete )
end
end
Michael [import]uid: 5712 topic_id: 724 reply_id: 300724[/import]