flash actionscript:
I am using the KeyListener.onKeyDown object to cpature and populate a string. It does not capture the Backspace, Comma, or Period keys. It will capture them if you click the text entry cursor in the text field, but I don't have the option of doing that in my code. I have attached code directly from the Flash Help File that will show the same issue I am having. Run the code and press either comma, period, or backspace and you will see that nothing happens. If you click the cursor in the filed then it works. Any ideas on how I can get they keys captured without having to click in the text field? Any assistance is much appreciated. this.createTextField("status_txt", this.getNextHighestDepth(), 100, 70, 100, 22); this.createTextField("username_txt", this.getNextHighestDepth(), 100, 100, 100, 22); this.createTextField("password_txt", this.getNextHighestDepth(), 100, 130, 100, 22); this.createEmptyMovieClip("submit_mc", this.getNextHighestDepth()); submit_mc.createTextField("submit_txt", this.getNextHighestDepth(), 100, 160, 100, 22); submit_mc.submit_txt.autoSize = "center"; submit_mc.submit_txt.text = "Submit"; submit_mc.submit_txt.border = true; submit_mc.onRelease = checkForm; username_txt.border = true; password_txt.border = true; username_txt.type = "input"; password_txt.type = "input"; password_txt.password = true; Selection.setFocus("username_txt"); // function checkForm():Boolean { if (username_txt.text.length == 0) { status_txt.text = "fill in username"; Selection.setFocus("username_txt"); return false; } if (password_txt.text.length == 0) { status_txt.text = "fill in password"; Selection.setFocus("password_txt"); return false; } status_txt.text = "success!"; Selection.setFocus(null); return true; }
JB - this question was just asked and answered here in the past day or so. Check this thread: http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=288&thre adid=1113138 It doesn't directly address the backspace key, but it does the comma and period. To quote: That will only occur in the Testing environment since the . and , are Keyboard Shortcuts for Step Forward/Backward One Frame... make sure you go to Control > Disable Keyboard Shortcuts after going to Control > Test Movie.
Don't see what you're looking for? Try a search.
|