Re: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
trace(Key.getCode()); returns "13" my workaround is sufficient for my needs. But I think, it is not a problem of Enter, only. I have to check if Muzak is right and this is a kind of a scope issue. 2007/8/14, Danny Kodicek <[EMAIL PROTECTED]>: > > Don't rant me for using _root, cause this was only for > > testing. I count the doubles out, which works fine for > > keyDown. The following code traces: > > enter down > > enter up > > enter up > > If this is only happening with Enter, I wonder if it's because Enter is > actually putting two characters into the text? (\n and \r?). Maybe you're > getting both of them from the OS. Is this a platform-specific problem? > > Danny > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
回复:RE: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
as i know , in the windows os, the Enter as \n! 在2007-08-14,"Danny Kodicek" <[EMAIL PROTECTED]> 写道: > Don't rant me for using _root, cause this was only for > testing. I count > the doubles out, which works fine for > keyDown. The following code traces: > > enter down > enter up > enter up If this is only happening with Enter, I > wonder if it's because Enter is actually putting two characters into the > text? (\n and \r?). Maybe you're getting both of them from the OS. Is this a > platform-specific problem? Danny > ___ > Flashcoders@chattyfig.figleaf.com To change your subscription options or > search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by > Fig Leaf Software Premier Authorized Adobe Consulting and Training > http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
回复:Re: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
yes, i think this is good, studyingthanks !!! 在2007-08-14,Muzak <[EMAIL PROTECTED]> 写道: The event will fire to all listeners, meaning that if you have multiple instances (of a class) that listens to Key events, you'l see multiple trace output. The following on the main timeline only displays output once: function onKeyUp() { if (Key.getCode() == Key.ENTER) trace("Enter pressed"); } Key.addListener(this); regards, Muzak - Original Message - From: "Matthias Dittgen" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Tuesday, August 14, 2007 11:26 AM Subject: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField > Hello, > > in my current project the onKeyDown event is fired twice, when the key > is hit in Textfields. > I googled already this problem and always found only a description of > the same problem as my one but no solution. Anyone solved this > already? > > Here's some example code (nothing special): > > // trace "Enter pressed" twice, while Enter is pressed only once > keyListener.onKeyUp = function() > { > if (Key.getCode() == Key.ENTER) > trace("Enter pressed"); > } > > Thanks, > Matthias ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
> Don't rant me for using _root, cause this was only for > testing. I count the doubles out, which works fine for > keyDown. The following code traces: > enter down > enter up > enter up If this is only happening with Enter, I wonder if it's because Enter is actually putting two characters into the text? (\n and \r?). Maybe you're getting both of them from the OS. Is this a platform-specific problem? Danny ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
The event will fire to all listeners, meaning that if you have multiple instances (of a class) that listens to Key events, you'l see multiple trace output. The following on the main timeline only displays output once: function onKeyUp() { if (Key.getCode() == Key.ENTER) trace("Enter pressed"); } Key.addListener(this); regards, Muzak - Original Message - From: "Matthias Dittgen" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Tuesday, August 14, 2007 11:26 AM Subject: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField > Hello, > > in my current project the onKeyDown event is fired twice, when the key > is hit in Textfields. > I googled already this problem and always found only a description of > the same problem as my one but no solution. Anyone solved this > already? > > Here's some example code (nothing special): > > // trace "Enter pressed" twice, while Enter is pressed only once > keyListener.onKeyUp = function() > { > if (Key.getCode() == Key.ENTER) > trace("Enter pressed"); > } > > Thanks, > Matthias ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
Don't rant me for using _root, cause this was only for testing. I count the doubles out, which works fine for keyDown. The following code traces: enter down enter up enter up var keyListener:Object = new Object(); _root.onEnter = function() {}; _root.countEnter = 0; keyListener.onKeyDown = function() { if (Key.getCode() == Key.ENTER && 0==_root.countEnter++) { trace("enter down "); _root.onEnter(); } }; keyListener.onKeyUp = function() { if (Key.getCode() == Key.ENTER) { _root.countEnter = 0; trace("enter up"); } }; Key.addListener(keyListener); Thank you all, Matthias 2007/8/14, Dennis - I Sioux <[EMAIL PROTECTED]>: > Guess you could check the focus? > And count the doubles out. > > - Original Message - > From: "Matthias Dittgen" <[EMAIL PROTECTED]> > To: "Flashcoders mailing list" > Sent: Tuesday, August 14, 2007 11:26 AM > Subject: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField > > > > Hello, > > > > in my current project the onKeyDown event is fired twice, when the key > > is hit in Textfields. > > I googled already this problem and always found only a description of > > the same problem as my one but no solution. Anyone solved this > > already? > > > > Here's some example code (nothing special): > > > > // trace "Enter pressed" twice, while Enter is pressed only once > > keyListener.onKeyUp = function() > > { > > if (Key.getCode() == Key.ENTER) > > trace("Enter pressed"); > > } > > > > Thanks, > > Matthias > > ___ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > > > -- > > This message has been scanned for viruses and > > dangerous content by MailScanner, and is > > believed to be clean. > > > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
But there is probably no guaranty that the event is fired twice on all FlashPlayers/OSes. So I would have to reset the state variable "manually". 2007/8/14, Ricky Bacon <[EMAIL PROTECTED]>: > Matthias Dittgen wrote: > > Hello, > > > > in my current project the onKeyDown event is fired twice, when the key > > is hit in Textfields. > > I googled already this problem and always found only a description of > > the same problem as my one but no solution. Anyone solved this > > already? > > > > Here's some example code (nothing special): > > > > // trace "Enter pressed" twice, while Enter is pressed only > > once > > keyListener.onKeyUp = function() > > { > > if (Key.getCode() == Key.ENTER) > > trace("Enter pressed"); > > } > > Use a state tracking variable instead of an event based call for > repeatable input events. > > -Ricky > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
Guess you could check the focus? And count the doubles out. - Original Message - From: "Matthias Dittgen" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Tuesday, August 14, 2007 11:26 AM Subject: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField Hello, in my current project the onKeyDown event is fired twice, when the key is hit in Textfields. I googled already this problem and always found only a description of the same problem as my one but no solution. Anyone solved this already? Here's some example code (nothing special): // trace "Enter pressed" twice, while Enter is pressed only once keyListener.onKeyUp = function() { if (Key.getCode() == Key.ENTER) trace("Enter pressed"); } Thanks, Matthias ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] onKeyDown/Up fires twice in dynamic TextField
Matthias Dittgen wrote: Hello, in my current project the onKeyDown event is fired twice, when the key is hit in Textfields. I googled already this problem and always found only a description of the same problem as my one but no solution. Anyone solved this already? Here's some example code (nothing special): // trace "Enter pressed" twice, while Enter is pressed only once keyListener.onKeyUp = function() { if (Key.getCode() == Key.ENTER) trace("Enter pressed"); } Use a state tracking variable instead of an event based call for repeatable input events. -Ricky ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] onKeyDown/Up fires twice in dynamic TextField
Hello, in my current project the onKeyDown event is fired twice, when the key is hit in Textfields. I googled already this problem and always found only a description of the same problem as my one but no solution. Anyone solved this already? Here's some example code (nothing special): // trace "Enter pressed" twice, while Enter is pressed only once keyListener.onKeyUp = function() { if (Key.getCode() == Key.ENTER) trace("Enter pressed"); } Thanks, Matthias ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com