Action When Mouse Leaves Flash Movie Area

Hello All!

I’ve got a flash movie that is a menu with a photo that is approximatly 700x300. I want an action that will trigger when the mouse leaves the flash movie all together. Is this possibe?

Is there a way to have have my movie know when the mouse is not in it and trigger something?

There is no good way until AS3, so either make the switch now or use a big transparent button.

Or you might be able to use JS to detect when the div the SWF is in loses focus. Not really sure if this is possible though.

[QUOTE=TheCanadian;1985502]Or you might be able to use JS to detect when the div the SWF is in loses focus. Not really sure if this is possible though.[/QUOTE]Wouldn’t you have to actually click outside the SWF to lose focus?

^Yes you would but theres probably a way to check mouse cords and if they change in the JS then the mouse is outside of the flash.

I used the wrong term, you can use this script to detect when the mouse leaves the div:

In FLA:

//requires TextField with instance name mouseStatus
import flash.external.ExternalInterface;
ExternalInterface.addCallback("mouseLeave", this, function ():Void {
 this.mouseStatus.text = "mouse is out";
});
ExternalInterface.addCallback("mouseEnter", this, function ():Void {
 this.mouseStatus.text = "mouse is in";
});

In HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <title>Detecting When Mouse Leaves Stage</title>
  <script type="text/javascript">
   function callEIMethod(name, method) {
    window[name][method]();
   }
  </script>
 </head>
 <body>
   <object onmouseout="callEIMethod('mouseLeaveExample', 'mouseLeave')" onmouseover="callEIMethod('mouseLeaveExample', 'mouseEnter')" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="182" height="118" id="mouseLeaveExample" align="middle">
   <param name="allowScriptAccess" value="sameDomain" />
   <param name="movie" value="mouseLeaveExample.swf" />
   <param name="quality" value="high" />
   <param name="bgcolor" value="#ffffff" />
   <embed src="mouseLeaveExample.swf" quality="high" bgcolor="#ffffff" width="182" height="118" name="mouseLeaveExample" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  </object>
 </body>
</html>

:hoser:

okay everyone is getting extremly complex for no reason why not something like
if(_xmouse<=5 or _xmouse>=690){
/actions/
}
would that not work if you just went a little bit inside of the borders and repeat that code for both x and y mouse coordinates. i dont see why that wont work.

Sticking with the big invisible button/movieclip is easiest as it avoids any cross-browser issues, and makes it simple to trigger events.