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

 

senocular.com ActionScript Library

createEmptyMovieClip.as

Name: createEmptyMovieClip rewrite - allows init object
Author: senocular: www.senocular.com
Date: 1899-12-31T00:34:28.400
Documentation:
Just rewriting createEmptyMovieClip to allow an init object
similar to that of attachMovie [MX]

Updated:
- replaces the __proto__ of the passed init object (incase it is used further along in the movie)

Example:


1
2
3
4
5
6
7
8
9
10
11
12
MovieClip.prototype.$cemc = MovieClip.prototype.createEmptyMovieClip;
MovieClip.prototype.createEmptyMovieClip = function(name, depth, init){
	var mc = this.$cemc(name, depth);
	if (init){
		var p = init.__proto__;
		init.__proto__ = null;
		for (var prop in init) mc[prop] = init[prop];
		init.__proto__ = p;
	}
	return mc;
}
ASSetPropFlags(MovieClip.prototype,"$cemc",1);