Latest in Code

Incrementing Search and Replace

Iterate Over An Object In Actionscript 3

Generating Cairngorm code

Flex Compiler Shell Controller, jEdit and Error List

Instant Slideshow JSFL

More pages in Code...

 

OnMouseOutside Event Listener


Just a quick listener script for those small flash files.
2005-06-28

This is a simple event listener class for ActionScript 2.0. If the mouse hasn't moved for x number of seconds it will fire an onMouseOutside event. It does not actually detect if the mouse leaves the stage area, as there is no simple method that works flawlessly. Instead it uses a simple timer, and works well enough for things such as side navigation elements and small flash movies embedded into hybrid sites.

Sample code (also included in .fla file):

import tv.ubergeek.mouse.OnMouseOutside;

var omo:OnMouseOutside = OnMouseOutside.getInstance();

var myListener:Object = new Object();
myListener.onMouseOutside = function(){
	trace("the mouse has left the building");
}
omo.addEventListener("onMouseOutside",myListener);
Download OnMouseOutside class and example code.
 
 

©2004 Chris Hill. All Rights Reserved.Legal Crapola