1 Reply Latest reply: Jun 30, 2012 8:40 AM by Adham_Dwikat RSS

    keyboard event dont dispatch when switch to arabic on mac

    Adham_Dwikat

      keyboard event dont dispatch when switch to arabic on mac

       

      i have faced aaproblem

      iam writing simple code in flash cs5 -as3

      i creat my project from windows  invironment

      after publishing the code and testing  it on mac , the keyborad event didnt fired , and that happens only when switch the keyboard to arabic language.

      but when the selected language is english every thing work fine

       

      this my code

       

      import flash.ui.Keyboard;
      import flash.events.KeyboardEvent;
      import fl.text.TLFTextField;
      import flash.text.TextFieldType;
      
      
      var trace_txt:TLFTextField= new TLFTextField()
      trace_txt.width=500
      trace_txt.height=400
      addChild(trace_txt)
      trace_txt.selectable=true;
      var txt:TLFTextField= new TLFTextField()//this is only for writing text in , to test when switching to arabic lang 
      txt.height=30
      txt.width=500
      txt.y=410
      trace_txt.y=5
      txt.x=5
      trace_txt.x=5
      txt.selectable=true
      txt.type=TextFieldType.INPUT
      addChild(txt)
      txt.border=true
      trace_txt.border=true
      stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler)
      function keyDownHandler(e:KeyboardEvent):void
      {
                try
                {
                           
                trace(e.keyCode)
                trace(String(e.keyCode))
                 var character:String = String.fromCharCode(e.charCode);
                trace_txt.appendText("keycode:"+e.keyCode+",   charCode:"+character+",   keyLocation :"+e.keyLocation +"\n")
                if(e.keyCode==Keyboard.A)
                {
                          trace_txt.appendText("a is pressed\n")
                }
                }
                catch(e)
                {
                          trace_txt.appendText("errroor\n")
                }
        
      }
      //stage.focus=stage;