MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING Reference page 463

Director scripting reference
Table of Contents

Advertisement

pointToWord()
Usage
-- Lingo syntax
spriteObjRef.pointToWord(pointToTranslate)
// JavaScript syntax
spriteObjRef.pointToWord(pointToTranslate);
Description
Function; returns an integer representing the number of a word located within the text or field
sprite at a specified screen coordinate, or returns -1 if the point is not within the text. Words are
separated by spaces in a block of text.
This function can be used to determine the word under the cursor.
Parameters
pointToTranslate
Example
These statements display the number of the word being clicked, as well as the text of the word, in
the Message window:
-- Lingo syntax
property spriteNum
on mouseDown me
pointClicked = _mouse.mouseLoc
currentMember = sprite(spriteNum).member
wordNum = sprite(spriteNum).pointToWord(pointClicked)
wordText = currentMember.word[wordNum]
put("Clicked word" && wordNum & ", the text" && wordText)
end
// JavaScript syntax
function mouseDown(me) {
var pointClicked = _mouse.mouseLoc;
var currentMember = sprite(this.spriteNum).member;
var wordNum = sprite(this.spriteNum).pointToWord(pointClicked);
var wordText = currentMember.getProp("word", wordNum);
trace("Clicked word " + wordNum + ", the text " + wordText);
}
See also
itemDelimiter, mouseLoc, pointToChar(), pointToItem(), pointToLine(),
pointToParagraph()
Required. Specifies the screen coordinate to test.
pointToWord()
463

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Director mx 2004

Table of Contents