duplicate movieclip in as3

well this snippet won’t work for every case, but you can do it like this:

import flash.display.Sprite;
 
public class ExClip extends Sprite
{
	private var _param : String;
 
	public function ExClip(param : String)
	{
		_param = param;
	}
 
	public function clone() : ExClip
	{
		var ret : ExClip = new ExClip(_param);
 
		return ret;
	}
 
}
 
// call
var tmp1 : ExClip = new ExClip("param1");
var tmp2 : ExClip = tmp1.clone();

Works fine for me.
So long

 

Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">