# Stage and AddChildAt(); formula problem

**URL:** <https://forum.kirupa.com/t/stage-and-addchildat-formula-problem/271151>\
**Category:** flash\
**Created:** [September 19, 2008, 4:22am UTC](https://forum.kirupa.com/t/stage-and-addchildat-formula-problem/271151 "2008-09-19T04:22:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ziul](https://avatars.discourse-cdn.com/v4/letter/z/3be4f8/32.png) [@Ziul](https://forum.kirupa.com/u/Ziul)\
**Post date:** [September 19, 2008, 4:22am UTC](https://forum.kirupa.com/t/stage-and-addchildat-formula-problem/271151/1 "2008-09-19T04:22:38Z")

</div>

Synopsis:

What I’m trying to do is place a ball on every corner of the main stage (4 ball instances) one assigned to each corner formulaically, so each ball is 50 pixels away on the x and y axis from the corner each ball is assigned to. I would like anyone to help me with this, it’s been on my mind all day.

here is my code so far.

```
ActionScript Code:
[LEFT][COLOR=#000000] **var** [/COLOR] counter:uint = [COLOR=#000080]0[/COLOR];

```

[COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000] **var** [/COLOR] i:uint = [COLOR=#000080]0[/COLOR]; i \< [COLOR=#000080]4[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] mcBall:Ball = [COLOR=#000000] **new** [/COLOR] BallCOLOR=#000000[/COLOR];  
[COLOR=#808080]_//some formula here_[/COLOR]  
addChildAt[COLOR=#000000]([/COLOR]mcBall, [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]

Maybe I’m going in the right direction by taking the stage and dividing it in 4, such as, stage.stageWidth / 2 and stage.stageHeight / 2 so that I break up the stage into 4 and from there figuring out a formula to assign each ball to each corner one by one as it passes through the loop.
