# onMotionChanged id problem

**URL:** <https://forum.kirupa.com/t/onmotionchanged-id-problem/263462>\
**Category:** flash\
**Created:** [June 16, 2008, 1:15pm UTC](https://forum.kirupa.com/t/onmotionchanged-id-problem/263462 "2008-06-16T13:15:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![skojdk](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@skojdk](https://forum.kirupa.com/u/skojdk)\
**Post date:** [June 16, 2008, 1:15pm UTC](https://forum.kirupa.com/t/onmotionchanged-id-problem/263462/1 "2008-06-16T13:15:23Z")

</div>

Hi.  
I have a problem here. in the onmotionfinished function i can’t get a uniqe identifier.  
trace i gives me six, which is the last number in the loop.  
trace this and it gives me ’ [tween] ’ . What should I write to get some uniqe ID? :stare:

```auto

for (var i:Number = 0; i < String(_startVal).length; i++)
        {                    
            if(isNaN(Number(stopVars["stop" + i + "_nbr"])))
            {                
                rollHolder["row" + i].field_mc0.field.text = stopVars["stop" + i + "_nbr"];
            }
            else
            {    
                var scope2 = this;
                stopObj["tween"+i] = new Tween(rollHolder["row"+i], "_y", mx.transitions.easing.Strong.easeOut, rollHolder["row"+i]._y, stopVars["stop" + i + "_nbr"], _time + time*(i*_easing), true);
                stopObj["tween"+(String(_startVal).length-1)].onMotionFinished = function()
                {
                    trace("dispatching 'rolled' ");
                    dispatchEvent({type:"rolled"});
                } 

                stopObj["tween" + i].onMotionChanged = function()
                {     
trace(i +"wtf, always the last number in the loop " );
trace(this +"this traces as: [tween]");
               
                    scope.blur(scope.rollHolder["row" + i],Math.floor(((this.position * -1)-1) *scope._motionblur));                
                }
               
                
            }    
        }

```

---

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [June 17, 2008, 4:28am UTC](https://forum.kirupa.com/t/onmotionchanged-id-problem/263462/2 "2008-06-17T04:28:13Z")

</div>

This thread may help

> **[Quick Array + Loop Question](https://www.kirupa.com/forum/showthread.php?t=93257&highlight=array)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!
