How to get the displayobject of an onComplete event?

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]

Ok, after a comment of Buzz, I tried the following and it works.

--\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -- Function to be fired, once the transition is done local function complete( target ) --\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* print( "event(complete target="..target.x..":"..target.y) end ... ... ... local params = { time=(dist\*3.5), x= event.x, y=event.y, onComplete=complete } transition.to (sprShoot, params)

[import]uid: 5712 topic_id: 724 reply_id: 1497[/import]