Grabbing the mouseWord
April 25, 1999
by Pat McClellan
Dear Multimedia Handyman,
I basically have these words popping up randomly on the screen (through use of randomness to switch cast members) and then when a user clicks on one of the words, I want that word to appear in a sentence at the top. Please help. Thanks.
Joe Blo
Yo Joe,
No sweat. You need to read up in your Lingo Dictionary about the command "the mouseWord". Also take a quick review of the section in your Using Director manual about dealing with fields -- specifically the part about "word X of field whatever".
Let's say that you have a field displayed on stage. That field, named "Example", contains the following text:
"This is a text field"
Now, using the message window do this...
put word 2 of field "Example" -- "is"
We can do the same thing in your movie with lingo, using the mouse to indicate which word. The term "the mouseWord" will return an integer which tells us which word in the field was clicked. To convert that integer to the actual word (string), we use the same syntax as the example above. Here's the behavior for it.
global gWordList on mouseUp me set myMem = the member of sprite the spriteNum of me set myField = the name of myMem set myWord = word (the mouseWord) of field myField append gWordList, myWord end
Download the source code in Mac or PC format.
Good luck with your project.
Copyright 1997-2024, Director Online. Article content copyright by respective authors.