Return to Snippet

Revision: 47069
at May 31, 2011 20:34 by dx0ne


Initial Code
var methodExist:Boolean;
try { //FP10 and up:
	methodExist = this["unloadAndStop"] != null;
}
catch (e:Error) { //FP9:
	methodExist = this["unload"] != null;
}

//or

public static function functionExists(obj:Object, name:String):Boolean {
	if ( obj == null ) return false;
	if (obj.hasOwnProperty(name)){
		return true;
	} else { return false; }
}

Initial URL
http://www.wastedpotential.com/?p=299

Initial Description


Initial Title
Check if method exist

Initial Tags


Initial Language
ActionScript 3