Hi nice list :-)

Can somebody have a look on this problem please ? i don't understand why
this duplicate method  doesn't work on nested movieClip :(
You can check a really simple example at
http://www.mymisu.com/niko/duplicateTest.rar

It's really a basic example, i've commented the duplicate problem in the
document class

Thanks in advance ...

Niko


On Sun, Aug 17, 2008 at 9:09 AM, Lair Nicolas <[EMAIL PROTECTED]>wrote:

> Hi Jonathan,
>
> thanks again for your feedback !!!
>
> In fact, _currentBackground is already on the stage - as a child of
> view_main !!!
>
> I've put a simple example online, can you have a look at it ?
> you can find it here : http://www.mymisu.com/niko/duplicateTest.rar
>
> Thanks a lot !!!
>
> Niko
>
>
>
> On Sat, Aug 16, 2008 at 9:11 PM, jonathan howe <[EMAIL PROTECTED]>wrote:
>
>> So, are you saying that the _currentBackground has a parent but is not on
>> the stage?
>> It's obviously possible if _currentBackground is nested inside something
>> else that is not on the stage, but in the simplest scenario, if it doesn't
>> have a parent, it's not going to run this block
>>
>>           if ( target.parent) {
>>               target.parent.addChild(duplicate);
>>           }
>>
>> So what does this output when you run it on _currentBackground:
>>
>>           if ( target.parent) {
>>               target.parent.addChild(duplicate);
>>                trace("duplicate():target.parent:",target.parent);
>>           }
>>
>> -jonathan
>>
>>
>> On Sat, Aug 16, 2008 at 8:27 PM, Lair Nicolas <[EMAIL PROTECTED]
>> >wrote:
>>
>> > 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
>> > > > Flashcoders@chattyfig.figleaf.com
>> > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME
>> 04101
>> > > _______________________________________________
>> > > Flashcoders mailing list
>> > > Flashcoders@chattyfig.figleaf.com
>> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> > >
>> > _______________________________________________
>> > Flashcoders mailing list
>> > Flashcoders@chattyfig.figleaf.com
>> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> >
>>
>>
>>
>> --
>> -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to