Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hey all, I am looking to have ke

Status
Not open for further replies.

ccie9545

Instructor
Aug 28, 2002
134
US
Hey all,

I am looking to have keystrokes replicated within the movie (just like when you are typing). Then i would like to have the text that was typed, compared to some other predefined text. If they match then move to another frame, if they don't match, then display some sort of error pop up message. I think that I need to use if...then and elseif... but not 100 percent sure of how this would be implemented. Also for the text, would just having an input text box be enough, or do I need to do something else. Any suggestions greatly appreciated, or some pointers to some tutorials that might cover these topics. I haven't gotten a chance to do much research, but have looked on flashkit.com and some other sites like that...

thanks a bunch.....

erik Erik Rudnick, CCIE No. 9545
mailto:erik@kuriosity.com
 
Okay ... do you need the text to be matched to the pre-defined string after every character is typed in (i.e. automatically), or would it be enough for the user to type a string in the input box, then press a button to make the comparison? _____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
the best reaction would be for the user to type a string, as you mentioned, then have the string checked when the user hit the <enter> key rather then pressed a button.

But, having the string checked after pressing a button would work as well if the above is not possible.

Thanks.... Erik Rudnick, CCIE No. 9545
mailto:erik@kuriosity.com
 
Best to stick with a button ... okay, make an input textfield, and set it's variable to _root.inputString. Also, set a variable in the first frame of your movie (main timeline) which sets the value you WANT the string to have, e.g.:

_root.matchString = &quot;This is what the user should have typed&quot;;

Also in the first frame of your main timeline, put this function code in:

function checkString(inputValue, gotoLabel) {
matchString = _root.matchString.toUpperCase();
tempString = inputValue.toUpperCase();
if (_root.matchString == _root.tempString) {
_root.gotoAndPlay(gotoLabel);
} else {
_root.gotoAndPlay(&quot;errorLabel&quot;)
}
}

Then make a button which will do the checking and use it to call the checkString() function we made:

on (release) {
_root.checkString(_root.inputString, &quot;labelName&quot;);
}

This will send information to the checkString function(), which will first capitalise both strings (differing capitalisation means that strings aren't considered equal - this will eliminate that possibility), check if they match or not, and either send your main movie to the label &quot;labelName&quot; (specified in the function call on the button) or to a standard &quot;errorLabel&quot; frame.

Let me know if you need any help imlementing this (functions can be a little hairy first time round!). _____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top