Problem :: when I click ball's disappear

I’ve this code

function createBall()
create…
ball…
code…

ball.addEventListener(“touch”,ballClicked)

end

function ballClicked(event)
event.target:removeBall() end

function removeBall(b)
b:removeSelf()
end

it’s work but have console error [import]uid: 42761 topic_id: 8031 reply_id: 308031[/import]

the removeBall function should placed before the code, where you want to use it.
in this case before the ballClicked function. [import]uid: 42078 topic_id: 8031 reply_id: 28583[/import]

console error

my code…

function createBall()
create
ball…
code…

ball:addEventListener(“touch”,ballClicked)

end

function removeBall(b)
print(“ball removed”)
b:removeSelf()
end

function ballClicked(event)
removeBall(event.target)
end [import]uid: 42761 topic_id: 8031 reply_id: 28634[/import]

Error on this Line

b:removeSelf()

Error Message is

[C]: in function ‘removeSelf’
/Users/xxx/Desktop/CoronaSDK/practice/main.lua:28: in function
(tail call): ?
?: in function <?:920>
?: in function <?:214>
[import]uid: 42761 topic_id: 8031 reply_id: 28635[/import]

you’re trying to remove it twice. once in the “began” phase and once in the “ended” phase. check for a specific phase and only remove it then [import]uid: 6645 topic_id: 8031 reply_id: 29076[/import]