• Global community
• Language:
• Deutsch
• English
• EspaÃ±ol
• FranÃ§ais
• PortuguÃªs
• æ—¥æœ¬èªžã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£
Dedicated community for Japanese speakers
• í•œêµ­ ì»¤ë®¤ë‹ˆí‹°
Dedicated community for Korean speakers
Exit
• The (x,y) coordinates in the text field are out of...

# The (x,y) coordinates in the text field are out of range of the field.

Explorer ,
May 29, 2023 May 29, 2023

Copied

I have a text field with many lines.
While checking the (x,y) coordinates of the field, I came across an incomprehensible problem.
The (x,y) coordinates in the text field are out of range of the field.

Why this problems occurred,
Please let me know if You can solve it.
I want to make the field's base point coordinates be (0,0).
Thank you

``````// sm => list Array
// There are no blanks before each character in the array.

for (var i: uint = 0; i < sm.length; i++) {
var tx: String = (i < sm.length - 1) ? "\n" : " ";
musicList.appendText(sm[i] + tx);
}
DisplayObject(musicList);

function mouseOutHandler(e: MouseEvent): void {
var topOut: Number = e.localY;
var leftOut: Number = e.localX;
var bottomOut: Number = e.localY;

// textField.height => 373.95
// The coordinates fluctuate slightly from time to time... For example

trace("TopOut    : " + topOut); // 7.999603271484375 ( Top > 0 )
trace("LeftOut   : " + leftOut); // -2.3534393310546875 ( Left < 0 )
trace("BottomOut : " + bottomOut); // 382.3807067871094 (Bottom > textField.height )
}
``````

Views

104

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Community Expert , May 29, 2023 May 29, 2023

localX and localY is a little funky, but your naming isn't helping things.  ie, there is no left, top, bottom.  it's the x and y, only.

anyway, it's more intuitive to use mouseX and mouseY.  if you want those relative to the object, use the object's corner coordinates.

3 Replies 3
Community Expert ,
May 29, 2023 May 29, 2023

Copied

localX and localY is a little funky, but your naming isn't helping things.  ie, there is no left, top, bottom.  it's the x and y, only.

anyway, it's more intuitive to use mouseX and mouseY.  if you want those relative to the object, use the object's corner coordinates.

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Jun 01, 2023 Jun 01, 2023

Copied

It will take a lot of time to fix my code, but your advice is correct.
Thank you

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Expert ,
Jun 01, 2023 Jun 01, 2023

Copied

LATEST

you're welcome.