[flexcoders] Re: Scaling Custom Components
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 [EMAIL PROTECTED] 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; ij; 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
[flexcoders] Re: Scaling Custom Components
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; ij; 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
[flexcoders] Re: Scaling Custom Components
The browser window is resizing. How would I just set the scaleX, scaleY in that situation? By setting those would i redraw for me? --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: removing and readding is a bit expensive. Are you scaling the content of a component? You should just set the scaleX,scaleY and reposition. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson Sent: Wednesday, March 28, 2007 9:57 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Scaling Custom Components 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 mailto:flexcoders%40yahoogroups.com , g_odds g_odds@ 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 mailto:flexcoders%40yahoogroups.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:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Bjorn Schultheiss Sent: Tuesday, March 27, 2007 6:19 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Nate Pearson Sent: Tuesday, March 27, 2007 5:22 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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; ij; 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
RE: [flexcoders] Re: Scaling Custom Components
removing and readding is a bit expensive. Are you scaling the content of a component? You should just set the scaleX,scaleY and reposition. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson Sent: Wednesday, March 28, 2007 9:57 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Scaling Custom Components 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 mailto:flexcoders%40yahoogroups.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 mailto:flexcoders%40yahoogroups.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:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Bjorn Schultheiss Sent: Tuesday, March 27, 2007 6:19 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Nate Pearson Sent: Tuesday, March 27, 2007 5:22 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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; ij; 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
RE: [flexcoders] Re: Scaling Custom Components
I think I need more context. If I had a component with a circle and triangle and the browser window resized, if I set the component's widht/height to use %, updateDisplayList will be called with different numbers and I would just set scaleX/scaleY on either the entire component or the circle and triangle. Also look at stage.scaleMode. We use noScale by default. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nate Pearson Sent: Wednesday, March 28, 2007 11:19 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Scaling Custom Components The browser window is resizing. How would I just set the scaleX, scaleY in that situation? By setting those would i redraw for me? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Alex Harui [EMAIL PROTECTED] wrote: removing and readding is a bit expensive. Are you scaling the content of a component? You should just set the scaleX,scaleY and reposition. From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Nate Pearson Sent: Wednesday, March 28, 2007 9:57 AM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Scaling Custom Components 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 mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com , g_odds g_odds@ 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 mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.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:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Bjorn Schultheiss Sent: Tuesday, March 27, 2007 6:19 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.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:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Nate Pearson Sent: Tuesday, March 27, 2007 5:22 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.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; ij; 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