# Help With Approach To A Problem

**URL:** <https://forum.kirupa.com/t/help-with-approach-to-a-problem/218356>\
**Category:** Uncategorized\
**Created:** [March 7, 2007, 2:53am UTC](https://forum.kirupa.com/t/help-with-approach-to-a-problem/218356 "2007-03-07T02:53:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WearDark](https://avatars.discourse-cdn.com/v4/letter/w/48db29/32.png) [@WearDark](https://forum.kirupa.com/u/WearDark)\
**Post date:** [March 7, 2007, 2:53am UTC](https://forum.kirupa.com/t/help-with-approach-to-a-problem/218356/1 "2007-03-07T02:53:46Z")

</div>

Scratch the original post… it was premature.

I decided it was easier to use an onEnterFrame function to script my movement and I’ve figured out the logic for what I am trying to accomplish…

Here’s some code:

```auto

var degrees:Number = 360 / containerArray.length;
var rotation:Number = 0;
    for(var i:Number = 0; i < containerArray.length; i++){
        containerArray*.onEnterFrame = function(){
            this._x = this._x + Math.cos(rotation * (Math.PI/180)) * 10;
            this._y = this._y + Math.sin(rotation * (Math.PI/180)) * 10;
        }
        rotation = rotation + degrees;
    }

```

In the above code, degrees is the number of degrees I want each item to move in relation to a circle, rotation is the actual angle I want to use in a particular movement…

the problem is that every clip is using the same (the first) value for rotation… how can I effectively update the rotation value so that each call to onEnterFrame() uses the correct value?

Any ideas?

Thanks again.
