TextField._y Property | Flash 6 |
vertical location of the text field, in pixels | read/write |
The floating-point _y property indicates the vertical position of theField's top border. It is measured relative to one of two possible coordinate spaces:
If theField resides on the main timeline, _y is measured relative to the Stage's top edge. For example, a _y of 20 indicates that theField's top border is 20 pixels below the Stage's top edge;-20 indicates 20 pixels above.
If theField resides on a movie clip instance's timeline, _y is measured relative to the registration point of that parent instance. For example, a _y of 20 indicates that theField's top border is 20 pixels below its parent instance's registration point; -20 indicates 20 pixels above.
The _y property (as with all vertical coordinates in Flash) increases downwards and decreases upwards�the opposite of the Cartesian coordinate system. Fractional _y values are approximated in Flash with antialiasing (blurring).
If theField is contained by an instance that is scaled and/or rotated, the coordinate space it inhabits is also scaled and/or rotated. For example, if theField's parent is scaled by 200% and rotated 90 degrees clockwise, _y increases toward the left, rather than downward, and a single unit of _y is 2 pixels instead of 1.
The _y property is often used in conjunction with _height to programmatically space or align text fields stacked vertically, as shown in the function makeFields( ):
// Try it out... makeFields(this, 6, 5, 100, 100, 200, 20); // Make a series of text fields function makeFields (clip, numFields, bufferSpace, startX, startY, width, height) { // Loop to make the requested fields for (var i = 0; i < numFields; i++) { // Make the current field clip.createTextField("field" + i + "_txt", i+1, startX, startY, width, height); // Store a reference to the current field var thisField = clip["field" + i + "_txt"]; // Turn on border and input thisField.border = true; thisField.type = "input"; // Position the current field if it's not the first if (i > 0) { var prevField = clip["field" + (i-1) + "_txt"]; thisField._y = prevField._y + prevField._height + bufferSpace; } } }
MovieClip.globalToLocal( ), MovieClip.localToGlobal( ), TextField._x