Game Development Reference
In-Depth Information
Let's add the bnkc object to the stage and find out what its position is:
1. Drag an instance of the Bnkc symbol onto the stage and give it the instance name bnkc.
2. Select the bnkc instance and check its t position in the Properties panel. My frog's t position is
1,, which you can see in Figure 9-17.
Figure 9-17. The frog's global x position is 50.
Okay, that's interesting. That must mean that the frog's right eye should have a global t position of
around 68.8 (or 68.75 to account for binary rounding). Adding 50 to 18.8 equals 68.8, which should be
its global position on the stage.
Does it actually have that t value? You can find out:
1. Add the following pn]_a statement to the I]ej[>qc?]p_dan class's constructor method:
2. Save the I]ej[>qc?]p_dan*]o file and test the project. You'll see this displayed in the Output
That's its local position! So if you refer to the right eye's t position using the format bnkc*
necdpAua*t, AS3.0 can only tell you where it is in relation to its parent object. If you want the
eye to interact in any useful way with the objects on the stage, you need its global t position—
and you can't access it.
Search Nedrilad ::

Custom Search