Hi, thanks for the response,

i already tested it, and it's executed but strangly not displayed on screen
:(

On Sat, Aug 16, 2008 at 7:48 PM, jonathan howe <[EMAIL PROTECTED]>wrote:

> "the only difference between _currentView and _currentBackground is that
> currentView
> is present on the stage"
>
> Aren't you testing for exactly that with the conditional " if (
> target.parent) {  } "?
>
> Throw a trace statement inside there and see if that block of code is
> actually executed.
>
> -jonathan
>
>
> On Sat, Aug 16, 2008 at 3:14 PM, Lair Nicolas <[EMAIL PROTECTED]
> >wrote:
>
> > 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
> >
>
>
>
> --
> -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to