Page 1 of 1
Referring to self?
Posted: Wed Jul 03, 2024 1:47 pm
by richmond62
Imagine a button called "B1" containing the script:
This will NOT work, and generate the following error message:
This IS problematic as I wish to delete an object from inwith its own code if certain conditions are satisfied . . .
Re: Referring to self?
Posted: Wed Jul 03, 2024 2:36 pm
by SparkOut
I'm pretty sure you can't. Why would you need to?
You could send the long name of me from the control's script to a handler in the stack script or library that takes the parameter and does a bit of error trapping, then deletes the object named in that parameter if error trapping says so.
Re: Referring to self?
Posted: Wed Jul 03, 2024 2:54 pm
by richmond62
Why would you need to?
Let's suppose you have a stack with a template image of, say, a fish.
Each time you click on the template fish it clones, and renames the clone.
Now our end-user has to drag the cloned image to a fishpond image: each time s/he manages s/he gets a point.
Each time s/he doesn't manage to drag "fisho" to the pond, the fish vanishes (i.e. deletes).
Re: Referring to self?
Posted: Wed Jul 03, 2024 4:42 pm
by Klaus
This works with my example button:
Code: Select all
on mouseup
put the long ID of me into tID
send "delete tID" to this cd in 1
end mouseup
Re: Referring to self?
Posted: Wed Jul 03, 2024 5:08 pm
by richmond62
Super!
I suppose the SEND IN 1 allows the script to finish.
Re: Referring to self?
Posted: Wed Jul 03, 2024 5:14 pm
by Klaus
Exactly, that is the trick!
