Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Fix for mozilla-windows-wmode-@-input bug

By: a guest on Jun 1st, 2011  |  syntax: ActionScript  |  size: 1.38 KB  |  hits: 323  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. MovieClip.prototype.setkeyfix = function(){
  2.         var myclip = this;
  3.        
  4.         /* Textfield Event */
  5.         myclip.mykey = new Object();
  6.         myclip.mykey.onChanged = function(in_txt:TextField) {
  7.                 if(myclip.fixchar and in_txt.text.length >= myclip.fixlength+2){
  8.                         in_txt.text = in_txt.text.substr(0,in_txt.text.length-2)+"@";
  9.                         Selection.setSelection(in_txt.text.length, in_txt.text.length);
  10.                 }
  11.                 myclip.fixlength = in_txt.text.length;
  12.                 myclip.fixchar = false;
  13.         }
  14.         myclip.mytf.addListener(myclip.mykey);
  15.         myclip.fixlength = 0;
  16.        
  17.         /* KEY Event */
  18.         myclip.mykey2 = new Object();
  19.         myclip.mykey2.onKeyDown = function(){
  20.                 var myexclude = new Array(8,13,27,32,45,46,43,95,127,64);
  21.                 if(Key.isDown(17) || Key.isDown(18)){
  22.                         if(Number(Key.getAscii()) > 0 and !myexclude.in_array(Number(Key.getAscii()))){
  23.                                 myclip.fixchar = true;
  24.                                 myclip.mytf.text = myclip.mytf.text+"@";
  25.                         Selection.setSelection(myclip.mytf.text.length, myclip.mytf.text.length);
  26.                         } else {
  27.                                 myclip.fixchar = false;
  28.                         }
  29.                 } else {
  30.                         myclip.fixchar = false;
  31.                 }
  32.         }
  33.         Key.addListener(myclip.mykey2);
  34. }
  35. MovieClip.prototype.removekeyfix = function(){
  36.         this.mytf.removeListener(this.mykey);
  37.         delete this.mykey;
  38.         Key.removeListener(this.mykey2);
  39.         delete this.mykey2;
  40. }
  41. input_email.setfocusfunc = function() {
  42.         input_email.setkeyfix();       
  43. }
  44. input_email.killfocusfunc = function() {
  45.         input_email.removekeyfix();
  46. }