Objects - Identifying Them
We know that objects are identified by their "Type" and "Name". e.g. button "box" image "sunset" field "Name" button "b1" But their are different forms for their name, depending on how much information that you need about it.
Suppose we have a button called "box"
It has a name = button "box" short name = "box" long name = button "box" of card id 1002 of stack "Untitled 1"
You can see this for yourself by adding the following script to your card
on mouseDown answer "the name is: " & the name of the target answer "the short name is: " & the short name of target answer "the long name is: " & the long name of target end mouseDown
and clicking on different objects on your card. You will see the differences. Why worry about such details?
1. Did you know that your program can create objects in the code? (using the "Clone" command). You can also delete them and modify them. So sometimes, you need to find an object's name to work with it.
2. If you have a lot of objects (buttons, enemies, etc) it makes it easier to name them with sequential numbers (e.g. "box1", "box2", "box3", etc. You can then write the code for one box ("boxN") and use the same code for all of them (then apply it to N=1, N=2, N=3...)
3. There are many other reasons....
|
|