Thanks everyone for your response. Now that I understand how children are added/removed i can take out some of my work arounds in other projects!
The scaling works great now. New question: Is this the best way to scale? Is it expensive to remove and re-add all the components when I want to redraw? In this component I have graphics and text and it seems really fast. But what if I used more complex things like sprites or containers? Would removing all of them then re-adding them be the best way to redraw? Thanks guys. --- In flexcoders@yahoogroups.com, "g_odds" <[EMAIL PROTECTED]> wrote: > > If you just want to remove all the children, do something like this: > > while (this.numChildren() > 0) > this.removeChildAt(0); > > > --- In flexcoders@yahoogroups.com, "Alex Harui" <aharui@> wrote: > > > > Nope, it is essentially an array. If I have > > > > var a:Array = [ "Nate", "Alex"]; > > a[2] = "Bjorn"; > > a.shift(); > > a[2] is no longer "Bjorn", you are now at a[1]. > > > > ________________________________ > > > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of Bjorn Schultheiss > > Sent: Tuesday, March 27, 2007 6:19 PM > > To: flexcoders@yahoogroups.com > > Subject: Re: [flexcoders] Scaling Custom Components > > > > > > > > Hey Alex, > > > > if 0 == childA > > can you insert childB at 99 for example. > > > > if so if you remove childA does childB's index change? > > > > can you ensure that you're child will remain at an index? > > > > > > > > On 28/03/2007, at 11:12 AM, Alex Harui wrote: > > > > > > > > > > Children renumber after one is removed > > > > 0 = childA > > 1 = childB > > 2 = childC > > > > After removeChildAt(0) > > > > 0 = childB > > 1 = childC > > > > Look at the code for removeAllChildren. > > > > It will either removeChildAt(0) j times or iterate backwards. > > > > ________________________________ > > > > From: flexcoders@yahoogroups.com > > [mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson > > Sent: Tuesday, March 27, 2007 5:22 PM > > To: flexcoders@yahoogroups.com > > Subject: [flexcoders] Scaling Custom Components > > > > > > > > I have a custom component that adds multiple shapes during > > UpdateDisplayList. When I scale the browser it calls update > > display > > list and draws over all of my shapes. > > > > I have tried: > > > > j = this.numChildren; > > for (i=0; i<j; i++){ > > this.removeChildAt(i); > > } > > > > Before I write redraw my shapes in UpdateDisplayList. I always > > get an > > outofbounds error after i exceed numAutomationChildren(?). If i > > try > > the same loop with numAutomationChildren nothing disappears. > > > > It won't let me call this.removeAllChildren (i think because I'm > > extending an UIComponent and not a Container)! Isnt there a way > > for > > me to get all those shapes outta there? > > > > Maybe I'm taking the wrong approach. > > > > Thanks in advance, > > > > Nate > > >