Re: [Flashcoders] RE: changing parent from child
definitely - parents call public methods on children, children fire events to inform parents to call methods i never call parent functions from a child a On 11 May 2010 18:15, jonathan howe wrote: > As soon as you removeChild on child1, it loses the reference to the parent. > If you want to continue on that tightly-coupled path, I would store a > temporary reference to the parent, then unload child one and use the > temporary reference to parent to load the new child. > > The design I would choose is to create an event that is broadcast from > child1. In the parent, I would add an event listener to child1. When the > event fires, unload 1 and load 2 from the eventlistener in parent. > > -jonathan > > > > On Tue, May 11, 2010 at 12:33 PM, Mattheis, Erik (MIN - WSW) < > ematth...@webershandwick.com> wrote: > > > Did you mean to say removeChildAt(0)? > > > > Have you tried Loader.unload()? > > > > _ _ _ > > Erik Mattheis > > Senior Web Developer > > Minneapolis > > T 952 346 6610 > > C 612 377 2272 > > > > Weber Shandwick > > Advocacy starts here. > > > > PRWeek Global Agency Report Card 2009 - Gold Medal Winner > > The Holmes Report Global Agency of the Year > > PR News Agency of the Year > > > > > > -Original Message- > > From: flashcoders-boun...@chattyfig.figleaf.com [mailto: > > flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore > > Sent: Tuesday, May 11, 2010 10:15 AM > > To: Flash Coders List > > Subject: [Flashcoders] changing parent from child > > > > I have a container swf - with a child... I want to have a button in the > > child that will change the child in the parent... so if I have: > > > > Parent.swf>Child 1.swf > > > > Once I click on a button in child 1, I will have > > > > Parent.swf>Child 2.swf > > > > I have tried removeChild(0) to take out the original swf, but that only > > seems to work once > > ___ > > 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 > ___ > 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
Re: [Flashcoders] RE: changing parent from child
As soon as you removeChild on child1, it loses the reference to the parent. If you want to continue on that tightly-coupled path, I would store a temporary reference to the parent, then unload child one and use the temporary reference to parent to load the new child. The design I would choose is to create an event that is broadcast from child1. In the parent, I would add an event listener to child1. When the event fires, unload 1 and load 2 from the eventlistener in parent. -jonathan On Tue, May 11, 2010 at 12:33 PM, Mattheis, Erik (MIN - WSW) < ematth...@webershandwick.com> wrote: > Did you mean to say removeChildAt(0)? > > Have you tried Loader.unload()? > > _ _ _ > Erik Mattheis > Senior Web Developer > Minneapolis > T 952 346 6610 > C 612 377 2272 > > Weber Shandwick > Advocacy starts here. > > PRWeek Global Agency Report Card 2009 - Gold Medal Winner > The Holmes Report Global Agency of the Year > PR News Agency of the Year > > > -Original Message- > From: flashcoders-boun...@chattyfig.figleaf.com [mailto: > flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore > Sent: Tuesday, May 11, 2010 10:15 AM > To: Flash Coders List > Subject: [Flashcoders] changing parent from child > > I have a container swf - with a child... I want to have a button in the > child that will change the child in the parent... so if I have: > > Parent.swf>Child 1.swf > > Once I click on a button in child 1, I will have > > Parent.swf>Child 2.swf > > I have tried removeChild(0) to take out the original swf, but that only > seems to work once > ___ > 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] RE: changing parent from child
Did you mean to say removeChildAt(0)? Have you tried Loader.unload()? _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Tuesday, May 11, 2010 10:15 AM To: Flash Coders List Subject: [Flashcoders] changing parent from child I have a container swf - with a child... I want to have a button in the child that will change the child in the parent... so if I have: Parent.swf>Child 1.swf Once I click on a button in child 1, I will have Parent.swf>Child 2.swf I have tried removeChild(0) to take out the original swf, but that only seems to work once ___ 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