Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Catching the ESC key within a Flash movie


Reply
 
Thread Tools Display Modes
  #1  
Old 08-15-2005, 09:31 PM
StealthRT's Avatar
StealthRT StealthRT is offline
Contributor
 
Join Date: Aug 2002
Posts: 761
Default 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
Reply With Quote
  #2  
Old 08-15-2005, 10:25 PM
zelg37 zelg37 is offline
Contributor

* Expert *
 
Join Date: Dec 2004
Location: Oregon, USA
Posts: 606
Default Flash-VB tutorials

Quote:
Originally Posted by StealthRT
Hey i need to know what the code would be to catch a ESC key in a flash movie.
Getting VB and Flash to work well together is not always simple..

I suggest you read through a few tutorials on the subject.
There are a few links in this post:
http://www.xtremevbtalk.com/showpost.php?p=1022642

However, just to give one example (method) I saw used once:
The flash programmer made an invisible button and put it on a layer of the main timeline that was present at all the times (to make Escape always available). Then he set the button to keystroke <escape> and use fscommand "quit".

Last edited by zelg37; 08-15-2005 at 10:42 PM.
Reply With Quote
  #3  
Old 08-17-2005, 05:47 PM
StealthRT's Avatar
StealthRT StealthRT is offline
Contributor
 
Join Date: Aug 2002
Posts: 761
Default

Thanks for your help zelg37, didnt help but thanks anyways.

David
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->