pointToChar()
459
Parameters
point
Required. Specifies the point to test.
See also
cursor()
,
mouseLoc
pointToChar()
Usage
-- Lingo syntax
spriteObjRef
.pointToChar(
pointToTranslate
)
// JavaScript syntax
spriteObjRef
.pointToChar(
pointToTranslate
);
Description
Function; returns an integer representing the character position located within the text or field
sprite at a specified screen coordinate, or returns -1 if the point is not within the text.
This function can be used to determine the character under the cursor.
Parameters
pointToTranslate
Required. Specifies the screen coordinate to test.
Example
These statements display the number of the character being clicked, as well as the letter, in the
Message window:
--Lingo syntax
property spriteNum
on mouseDown me
pointClicked = _mouse.mouseLoc
currentMember = sprite(spriteNum).member
charNum = sprite(spriteNum).pointToChar(pointClicked)
actualChar = currentMember.char[charNum]
put("Clicked character" && charNum & ", the letter" && actualChar)
end
// JavaScript syntax
function mouseDown() {
var pointClicked = _mouse.mouseLoc;
var currentMember = sprite(this.spriteNum).member;
var charNum = sprite(this.spriteNum).pointToChar(pointClicked);
var actualChar = currentMember.getProp("char", charNum);
put("Clicked character " + c", the letter " + actualChar);
}
See also
mouseLoc
,
pointToWord()
,
pointToItem()
,
pointToLine()
,
pointToParagraph()
Summary of Contents for DIRECTOR MX 2004
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...