# Trouble with dynamic positioning \_y

**URL:** <https://forum.kirupa.com/t/trouble-with-dynamic-positioning--y/186675>\
**Category:** Uncategorized\
**Created:** [April 23, 2006, 4:10pm UTC](https://forum.kirupa.com/t/trouble-with-dynamic-positioning--y/186675 "2006-04-23T16:10:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![crobar](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/crobar/32/2073_2.png) [@crobar](https://forum.kirupa.com/u/crobar)\
**Post date:** [April 23, 2006, 4:10pm UTC](https://forum.kirupa.com/t/trouble-with-dynamic-positioning--y/186675/1 "2006-04-23T16:10:21Z")

</div>

I’m stumped with this maybe someone here can help.

I have a list of collapsible move clips.  
When anyone of the clips is closed or opened the rest or the clips in the list react by changing position.  
I had this running with and on enter frame event. But that was a memory hog when too many items were in the list.  
So what I want to do is this  
When any clip is closed or opened it triggers this function

```auto
function resetY() {
   
  for (var i = order; i>=many; i++) {
  **this.onEnterFrame = function() {**
  _y = previousitem._y+previousitem.box._height;
  roundB4me = Math.ceil(previousitem._y+previousitem.box._height);
  roundme = Math.ceil(_y);
                          if (roundB4me == roundme) {
                                      delete this.onEnterFrame;
                          }
   
                          
              }
  }

```

My problem is with placing this clip on clips in the \_parent.  
So what I want is more like this:

```auto
function resetY() {
   
  for (var i = order; i>=many; i++) {
  **_parent[nextClip+i]onEnterFrame = function() {**
  _y = previousitem._y+previousitem.box._height;
  roundB4me = Math.ceil(previousitem._y+previousitem.box._height);
  roundme = Math.ceil(_y);
                          if (roundB4me == roundme) {
                                      delete this.onEnterFrame;
                          }
   
                          
              }
  }

```

But I cant use: \_parent[nextClip+i]onEnterFrame = function() {  
Can any one help me out with this?  
Thanks for any help!

---

<div class="post-metadata">

**Author:** ![B\_L\_U\_E](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@B\_L\_U\_E](https://forum.kirupa.com/u/B_L_U_E)\
**Post date:** [April 23, 2006, 4:30pm UTC](https://forum.kirupa.com/t/trouble-with-dynamic-positioning--y/186675/2 "2006-04-23T16:30:23Z")

</div>

That alternative still uses onEnterFrame though.

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 23, 2006, 4:41pm UTC](https://forum.kirupa.com/t/trouble-with-dynamic-positioning--y/186675/3 "2006-04-23T16:41:15Z")

</div>

ummm… you can do this:

```auto
function resetY() {
   
  for (var i = order; i>=many; i++) {
var blah:MovieClip = _parent[nextClip+i]
  blah.onEnterFrame = function() {
  _y = previousitem._y+previousitem.box._height;
  roundB4me = Math.ceil(previousitem._y+previousitem.box._height);
  roundme = Math.ceil(_y);
                          if (roundB4me == roundme) {
                                      delete this.onEnterFrame;
                          }
   
                          
              }
  }

```

---

<div class="post-metadata">

**Author:** ![mathew\_er](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mathew\_er](https://forum.kirupa.com/u/mathew_er)\
**Post date:** [April 23, 2006, 4:44pm UTC](https://forum.kirupa.com/t/trouble-with-dynamic-positioning--y/186675/4 "2006-04-23T16:44:39Z")

</div>

btw \_parent[nextClip+i]onEnterFrame = function() { wont work… you forgot a dot… \_parent[nextClip+i]\*\*.\*\*onEnterFrame = function() {

---

<div class="post-metadata">

**Author:** ![crobar](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/crobar/32/2073_2.png) [@crobar](https://forum.kirupa.com/u/crobar)\
**Post date:** [April 23, 2006, 7:28pm UTC](https://forum.kirupa.com/t/trouble-with-dynamic-positioning--y/186675/5 "2006-04-23T19:28:33Z")

</div>

figures i left out the period…:sigh:

but like was mentioned it still used on enter frame like 25 at a time.  
so i just paced them one after the other.

```auto

function resetY(clicked) {
        nextclip=clicked+1
        nextafter=clicked+2
        var nextup:MovieClip = _parent["textholder"+nextclip]
        var nextafter:MovieClip = _parent["textholder"+nextafter]
        nextup.onEnterFrame = function() {
            nextup._y = nextup.previousitem._y+nextup.previousitem.box._height;
            roundB4me = Math.ceil(nextup.previousitem._y+nextup.previousitem.box._height);
            roundme = Math.ceil(nextup._y);
            if (roundB4me == roundme) {
                nextafter.resetY(nextclip)
                delete this.onEnterFrame;
            }
        };
}

```

so now only one on enter frame even happens at a time making the whole thing run much smoother!  
thanks for all your help!
