im trying to work out how to do something really hard and i think the only way that i can do it is to pass a timer an argument. i want to create a class that moves buttons to the right on mouse over, and moves them back on roll out. but im trying to make a sort of easing effect in action script.

the last movement should be 1 pixel, the second to last move 2 pixels, the third to last be 3 pixels etc.

heres what i have in my head: the class will have a variable that stores the origional x coordinate and the desired resting coordinate for the button on roll over. on roll over, the script calculates the number of pixels between where it is and the destination, or on roll out, it would calculate the number of pixels from its current posision to the origional posision. then it would use that number to do the following calculation:

while(numPix>countPix)
{
count++
countPix+=count
}
this.x=destinationX-countPix /*or + count pix depending on weather its moving to the right or left*/
while(count>0)
{
this.x+=count /*or -= if moving back*/
count--
/*timer would elapse here*/
}

so u see, it counts the number of pixels it needs to move, then it counts the number of increments (count) it needs to move between timers for this sort of easing motion. i just dont know how to implement this in actionscript