pointToItem()
Usage
-- Lingo syntax
spriteObjRef.pointToItem(pointToTranslate)
// JavaScript syntax
spriteObjRef.pointToItem(pointToTranslate);
Description
Function; returns an integer representing the item position in the text or field sprite at a specified
screen coordinate, or returns -1 if the point is not within the text. Items are separated by the
itemDelimiter
This function can be used to determine the item under the cursor.
Parameters
pointToTranslate
Example
These statements display the number of the item being clicked, as well as the text of the item, in
the Message window:
--Lingo syntax
property spriteNum
on mouseDown me
pointClicked = _mouse.mouseLoc
currentMember = sprite(spriteNum).member
itemNum = sprite(spriteNum).pointToItem(pointClicked)
itemText = currentMember.item[itemNum]
put("Clicked item" && itemNum & ", the text" && itemText)
end
// JavaScript syntax
function mouseDown() {
var pointClicked = _mouse.mouseLoc;
var currentMember = sprite(this.spriteNum).member;
var itemNum = sprite(this.spriteNum).pointToItem(pointClicked);
var itemText = currentMember.getProp("item",itemNum);
trace( "Clicked item " + itemNum + ", the text " + itemText);
}
See also
itemDelimiter, mouseLoc, pointToChar(), pointToWord(), pointToItem(),
pointToLine(),
460
Chapter 12: Methods
property, which is set to a comma by default.
Required. Specifies the screen coordinate to test.
pointToParagraph()
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