Hi all,
i'm trying to duplicate a nested movieClip in AS3, but it does not work :-(
In my main fla, i've a movieClip named "view_main" that contains another
movieClip named "background_mc"
I want to duplicate the background_mc movieClip by using the constructor
property like that :
_currentView = this.view_main as MovieClip;
_currentBackground = this._currentView.background_mc as MovieClip;
_currentBackgroundCopy = duplicate(this._currentBackground) as MovieClip;
public function duplicate(target:DisplayObject):DisplayObject
{
var targetClass:Class = Object(target).constructor;
var duplicate:DisplayObject = new targetClass();
if ( target.parent) {
target.parent.addChild(duplicate);
}
return duplicate;
}
The call to duplicateDisplayObject(this._currentBackground, true) return the
correct movieClip but it doesn't appear on the screen - looks like the
addChild does not work ...
Even better, it works if i call duplicate(this.currentView) and the only
difference between _currentView and _currentBackground is that currentView
is present on the stage ...
Thanks in advance :-)
Niko
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders