Hi, thanks for your answers
Your command starts: "on destroyButton" but closes with "end destroySmiley" (so I would imagine it doesn't even compile properly...)
Sorry it's a rewriting problem.
You may, as you said, be finding the problem is because of clicking with the mouse just before the time to live has expired. If the delete command is being issued because of the keypress, but the button has just been deleted by the timer, then the delete command in the keydown handler will not find a target to delete, thus generating an error.
Not really. I don't want the keyDown command delete my buttons, the 2 previous scripts are the only ones to do that, I want to do another action (for the moment just display a message with answer command as a test).
So I don't think add the code ligne "if there is a button (the target) then" could solve the problem (in fact I tried and it don't change anything).
And if we forget the second script and just keep
Code: Select all
on mouseUp
if the name of the target contains "button" then
delete the target
end if
end mouseUp
It still don't work half a time! (I click on a button -> the keyDown handler works, I click on a button again -> it stop to works).
Buttons are created with the command < create button "target" in group "groupe" > with a random position but in view of my test that's not a source of the problem.