jeudi 2 février 2017

AS3 and Flex 4 - Applying AS3 Class to Flex mxml file

I have this AS3 Class here which detects if a mouse has moved:

package
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;

    public class ApplicationTimer extends Sprite
    { 

        public function ApplicationTimer()
        {   
            stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoved);
        }

        public function mouseMoved(event:MouseEvent):void 
        { 
            trace("mouse moved")
        }

    }
}

What I am trying to do is apply this class my main mxml Flex file so when my mouse moves in my project the mouseMoved method is called. How would I do this?

Aucun commentaire:

Enregistrer un commentaire