11 Replies Latest reply on Mar 27, 2008 6:10 AM by RodrigoTatto

    Canvas & keyDown handler

    Smoke007
      Hi forum,
      I'm developing component based on Canvas. I need to check which key was pressed but it looks like keyDown event is never thrown.

      Could you advice me where the problem is? Thanks.

      Smoke007

      My code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%" keyDown="onkeyDown(event)">
      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;

      private function onkeyDown(event:Event):void
      {
      Alert.show("ok");
      }
      ]]>
      </mx:Script>

      </mx:Canvas>