Hi Anuj, According to Flash Help files for getChildAt(), this error is generated by getChildAt() when, "RangeError - Throws if the index does not exist in the child list." Either your "aa" variable is not evaluating correctly inside the function or there is no child object at depth index 0 when the function is called.
Hth, Bob Leisle Headsprout Software & Engineering www.headsprout.com Where kids learn to read! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of anuj sharma Sent: Monday, February 25, 2008 1:20 PM To: Flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] RangeError: Error #2006: The supplied index is out ofbounds. 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 _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders