0 Replies Latest reply on Jan 6, 2011 8:27 PM by EMelville

    Convert Mouse Idle Monitor (AS3) to Flex

    EMelville Level 1

      Does anyone have an idea how to turn this project into a workable flex application? http://evolve.reintroducing.com/2008/07/11/as3/as3-mouseidlemonitor/

       

      Take a look at what I tried below:

       

       

      <?xml version="1.0" encoding="utf-8"?> 
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"    
      layout="absolute" creationComplete="init();"> 
      <mx:Script>
       <![CDATA[
      import com.reintroducing.mouse.MouseIdleMonitor;
      import com.reintroducing.events.MouseIdleMonitorEvent;
      
      public var mim:MouseIdleMonitor = new MouseIdleMonitor(stage, 100);
      
      public function init():void
      {
      
      mim.addEventListener(MouseIdleMonitorEvent.MOUSE_ACTIVE, handleMouseActive);
      mim.addEventListener(MouseIdleMonitorEvent.MOUSE_IDLE, handleMouseIdle);
      mim.start();
      }
      
      public function handleMouseActive($evt:MouseIdleMonitorEvent):void
      {
       info_txt.text = "Mouse is active.";
      }
      
      public function handleMouseIdle($evt:MouseIdleMonitorEvent):void
      {
       info_txt.text = "Mouse has been inactive for " + mim.idleTime + " milliseconds.";
      } 
       
       ]]>
      </mx:Script>
       <mx:Label x="300" y="10" text="Label" id="info_txt"/>
       </mx:Application>