Judging by the error message, your container doesn't have 11 children added.
Consider using a for loop instead of manually coding all that. On 2/25/08, anuj sharma <[EMAIL PROTECTED]> wrote: > Hi Guys > I am making an Auto-Arrange button and clicking on which arranges all the > children of the container( which are on the main stage) in the tile format. > Basically on clicking, I manually move those child on the stage to > particular coordinates as shown in my code. I have pasted my code below. My > problem is that as soon as i click on the auto arrange button I am getting > error "RangeError: Error #2006: The supplied index is out of bounds.". > Please let me know what i am doing wrong and i will appreciate if you let me > know how would i fix this > Thanks a lot guys > Anuj > > ******************CODE********************** > var aa:Number=0; > var xcoord:Number=-300; > var ycoord:Number=-200; > var xcoord1:Number=450; > var xcoord2:Number=850; > var xcoord3:Number=1250; > var ycoord1:Number=350; > var ycoord2:Number=650; > //Button Listener > btn_AA.addEventListener(MouseEvent.CLICK,autoArrange); > function autoArrange(event:MouseEvent):void > { > if(container.getChildAt(aa)!=null) > { > container.getChildAt(aa).x=xcoord; > container.getChildAt(aa).y=ycoord; > //Arrange Second > container.getChildAt(aa+1).x=xcoord+xcoord1; > container.getChildAt(aa+1).y=ycoord; > //Arrange Third > container.getChildAt(aa+2).x=xcoord+ xcoord2; > container.getChildAt(aa+2).y=ycoord; > //Arrange Forth > container.getChildAt(aa+3).x=xcoord+xcoord3; > container.getChildAt(aa+3).y=ycoord; > //Arrange Fifth > container.getChildAt(aa+4).x=xcoord; > container.getChildAt(aa+4).y=ycoord+ycoord1; > //Arrange Sixth > container.getChildAt(aa+5).x=xcoord+xcoord1; > container.getChildAt(aa+5).y=ycoord+ycoord1; > //Arrange Seventh > container.getChildAt(aa+6).x=xcoord+ xcoord2; > container.getChildAt(aa+6).y=ycoord+ycoord1; > //Arrange Eight > container.getChildAt(aa+7).x=xcoord+xcoord3; > container.getChildAt(aa+7).y=ycoord+ycoord1; > //Arrange Ninth > container.getChildAt(aa+8).x=xcoord; > container.getChildAt(aa+8).y=ycoord+ycoord2; > //Arrange Tenth > container.getChildAt(aa+9).x=xcoord+xcoord1; > container.getChildAt(aa+9).y=ycoord+ycoord2; > //Arrange Eleventh > container.getChildAt(aa+10).x=xcoord+ xcoord2; > container.getChildAt(aa+10).y=ycoord+ycoord2; > } > } > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- Cory Petosky : Lead Developer : PUNY 1618 Central Ave NE Suite 130 Minneapolis, MN 55413 Office: 612.216.3924 Mobile: 240.422.9652 Fax: 612.605.9216 http://www.punyentertainment.com _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders