
08-15-2005, 09:31 PM
|
 |
Contributor
|
|
Join Date: Aug 2002
Posts: 761
|
|
Catching the ESC key within a Flash movie
|
Hey i need to know what the code would be to catch a ESC key in a flash movie. This is the code i have in flash right now that works when testing it in the flash player:
Code:
Selection.addListener(inputListener);
keyListener = new Object();
keyListener.onKeyUp = function () {
if (Key.getCode() == Key.ENTER) {
fscommand("EnterTxt", TEXT1);
}
else if (Key.getCode() == Key.ESCAPE) {
fscommand("EnterTxt", "ESC");
gotoAndPlay(25);
}
else {
}
}
Key.addListener(keyListener);
Now this is my VB code:
Code:
Public Sub EnterTxt(args As String)
If args = "test" Then
FlashVb.flash1.Stop
FlashVb.flash1.Visible = False
Exit Sub
ElseIf args = "ESC" Then
FlashVb.flash1.Stop
FlashVb.flash1.Visible = False
Exit Sub
Else
FlashVb.flash1.SetVariable "textfieldX", "Wrong Password"
FlashVb.flash1.SetVariable "ThisTxt.text", ""
End If
End Sub
The enter button works and when i type in "test" it stops the flash and clears it like it should.. but it doesnt work with the ESC button, it just sits there. Although it worked just fine in the test in the flash player.
So what am i missing??
David
|
|