Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

senocular.com ActionScript Library

onReleases.as

Name: onReleases - combines onRelease and onReleaseOutside
Author: senocular: www.senocular.com
Date: 1899-12-31T00:15:55.100
Documentation:
Object onReleases: sets both onRelease and onReleaseOutside
for your object to the same value.  onReleaseOutside is
commonly overlooked in some actions like dragging where it
is much needed in case the mouse is released outside the
viewable area of the clip and an onRelease is not called. This
sets both with one assignment to making that inclusion easier.

- setting sets both onRelease and onReleaseOutside
- retrieving or checking returns only onRelease

Example:
this.onReleases = function(){
	this.endDrag();
}
trace(this.onReleases); // [type Function]
trace(this.onReleasesOutside); // [type Function]

1
2
3
4
5
6
7
8
Object.prototype.addProperty("onReleases",
	function(){
		return this.onRelease;
	},function(f){
		this.onRelease = this.onReleaseOutside = f;
	}
);
ASSetPropFlags(Object.prototype, "onReleases", 5);