pointToLine()
461
pointToLine()
Usage
-- Lingo syntax
spriteObjRef
.pointToLine(
pointToTranslate
)
// JavaScript syntax
spriteObjRef
.pointToLine(
pointToTranslate
);
Description
Function; returns an integer representing the line position in the text or field sprite at a specified
screen coordinate, or returns -1 if the point is not within the text. Lines are separated by carriage
returns in the text or field cast member.
This function can be used to determine the line under the cursor.
Parameters
pointToTranslate
Required. Specifies the screen coordinate to test.
Example
These statements display the number of the line being clicked, as well as the text of the line, in the
Message window:
-- Lingo syntax
property spriteNum
on mouseDown me
pointClicked = _mouse.mouseLoc
currentMember = sprite(spriteNum).member
lineNum = sprite(spriteNum).pointToLine(pointClicked)
lineText = currentMember.line[lineNum]
put("Clicked line" && lineNum & ", the text" && lineText)
end
// JavaScript syntax
function mouseDown() {
var pointClicked = _mouse.mouseLoc;
var currentMember = sprite(this.spriteNum).member;
var lineNum = sprite(this.spriteNum).pointToLine(pointClicked);
var lineText = currentMember.getProp("line", lineNum);
put("Clicked line " + l ", the text " + lineText);
}
See also
itemDelimiter
,
mouseLoc
,
pointToChar()
,
pointToWord()
,
pointToItem()
,
pointToLine()
,
pointToParagraph()
Содержание DIRECTOR MX 2004-DIRECTOR SCRIPTING
Страница 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Страница 48: ...48 Chapter 2 Director Scripting Essentials...
Страница 100: ...100 Chapter 4 Debugging Scripts in Director...
Страница 118: ...118 Chapter 5 Director Core Objects...
Страница 594: ...594 Chapter 12 Methods...
Страница 684: ...684 Chapter 14 Properties See also DVD...
Страница 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Страница 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Страница 889: ...netPresent 889 _player alert Sorry the Network Support Xtras could not be found See also Player...
Страница 1102: ...1102 Chapter 14 Properties...