A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Detect Mouse Off Stage

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    Detect Mouse Off Stage

    I have a movie clip button that fills the stage - therefore the problem I have is that when I mouse off the button, the movie clip does not trigger the rollOut event.

    I have been told I can either some as3 script for this or javascript - I just have no idea how. Can anyone help me to write this code?

    Thanks

    Kit

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You can use a listener on the stage for the Event.MOUSE_LEAVE event.

  3. #3
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Here are the event listeners for AS:

    PHP Code:
    stage.addEventListener(MouseEvent.MOUSE_MOVE, function(e:MouseEvent):void{
        
    trace('mouse is on the stage');
    });

    stage.addEventListener(Event.MOUSE_LEAVE, function(e:Event):void{
        
    trace('mouse has left the stage');
    });

    stage.addEventListener(Event.DEACTIVATE, function(e:Event):void{
        
    trace('swf has lost focus');
    }); 
    You can also listen to the mouse through js...here's a good example of that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center