Did you try var listener:Object = new Object();

Listener.keyUp = …

 

You weren’t really creating the listener object there…

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Caroline
Sent: Monday, December 05, 2005 2:21 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Handling Base Class (Low level Events)

 

Hi,

It seems that we cannot handle low-level events (keyUp, keyDown, etc)
in Flex through the listener objects.

For example, I cannot get the following to work:

<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml"
creationComplete="initApp()">

<mx:Script>
   <![CDATA[
       import de.richinternet.utils.Dumper;
       function initApp() {
      var listener:Object;
                 
      listener.keyUp = function () {
            trace("HELLO"); // Never gets here
      }
                 
      dateChooser.addEventListener("keyUp", listener);
      }
   ]]>
</mx:Script>

<mx:DateChooser id="dateChooser" width="100%" />

I know that this works:
<mx:DateChooser id="dateChooser" keyUp="{trace('HELLO')}" width="100%" />

According to Flash 8 Documentation this should work:

listenerObject = new Object();
listenerObject.keyUp = function(eventObject){
   ...
}
componentInstance.addEventListener("keyUp", listenerObject)

Anyone have any ideas?










--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to