[quoted text, click to view] paul_the_brickwall wrote:
> I wanted to do somat on my site where you type somethin, say "sample" and when the user has typed this a hidden video plays or something, is there anyway to do this?
Of course , why not .
First need to define some array of the characters .
Using the KEY codes from Help files I spell out "sample"
myKeyArray = [83, 65, 77, 80, 76, 69];
mcKeyCatcher.fncSetKeyvalues(myKeyArray);
stop();
Now , make a dynamic field (for this demo only to see results)
and give it variable name "tfStatus"
Next , make a movie clip , in that clip on a frame place the following action :
function fncSetKeyvalues(KeyArray) {
iTesting = 0;
arrKeys = KeyArray;
bTesting = true;
}
function fncTestKey(iKeyCode) {
trace("testing: "+iKeyCode+" against "+arrKeys[iTesting]);
if (iKeyCode == arrKeys[iTesting]) {
iTesting++;
if (iTesting == arrKeys.length) {
return 1;
} else {
return 0;
}
} else {
iTesting = 0;
return 2;
}
}
stop();
Now, get out of the movie clip , back to stage , select the clip and hit F9
to open the action editor , paste in final piece of code :
onClipEvent (keyUp) {
thisKeyCode = Key.getCode();
if (bTesting) {
trace("key pressed: " add thisKeyCode);
result = fncTestKey(thisKeyCode);
if (result == 0) {
_root.tfStatus = "Cool man.. keep going";
} else if (result == 1) {
_root.tfStatus = "You Did It!";
getURL("http://www.yahoo.com", "_blank");
} else {
_root.tfStatus = "You stuffed up - Starting over";
}
}
}
Please see sample made based on the above description :
http://www.flashfugitive.com/keySequence.swf You can of course change the getUrl action to whatever you want
after user key in correct key sequence.
--
Regards
urami_*
<hol>
http://flashfugitive.com/ </hol>
By The way:
If you try to mail me , DO NOT *laugh*