Game Development Reference
In-Depth Information
You can access all this information using dot notation. All you need to do is use the name
of the event object, followed by a dot, and then followed by the property of the event
object that you need to access. Based on the preceding example, you could use the follow-
ing code to find out the x position of where the mouse clicked the stage:
bqj_pekjkj?he_g$arajp6IkqoaArajp%6rke`
w
pn]_a$arajp*op]caT%7
y
If there are other objects on the stage, you can find out the name of the object that
was clicked by using the p]ncap property. Using arajp*p]ncap will give you the name
of the object you clicked:
bqj_pekjkj?he_g$arajp6IkqoaArajp%6rke`
w
pn]_a$arajp*p]ncap%7
y
If you use this in the example code, it will output the following:
Wk^fa_pOp]caY
That's the op]ca .
Understanding other events
This example showed you how to use the ?HE?G event from the IkqoaArajp class. The IkqoaArajp
class contains many other events that you're sure to find some use for. Table 3-1 shows the event
names and what they do.
Table 3-1. Event names
Event name
Triggers an event when . . .
?HE?G
The left mouse button is pressed down and released
@KQ>HA[?HE?G
The left mouse button is double-clicked
IKQOA[@KSJ
The left mouse button is pressed down
IKQOA[IKRA
The mouse moves
IKQOA[KQP
The mouse leaves the area of an object
IKQOA[KRAN
The mouse moves over an object
IKQOA[QL
The left mouse button is released
IKQOA[SDAAH
The mouse wheel is moved
NKHH[KRAN
The mouse moves over an object (or any of its subobjects)
NKHH[KQP
The mouse moves away from an object (or any of its subobjects)
 
Search Nedrilad ::




Custom Search