MX6- Script trouble, movement easing

Hi,
I’m sure this is very simple, been searching the boards for ages, but can’t find the right solution. I want to create a simple actionscript rectangle mask which slides down to reveal an image when an swf is opened.

I would use a standard tween but the image is large and I want to have some nice easing going on.

This is what I have to move the rectangle:

onClipEvent (load) {
this._y = 50;
}
onClipEvent (enterFrame) {
if (this._y<300) {
this._y += 5;
}
}

I found this script for the easing, but I’m not sure where it goes in the above code:

k = elapsedTime/duration; // k = 0-1
k = kk(3-2*k); // apply easing
_x = start + (target - start)*k;

I’m hoping its just a case of piecing these two bits of code together.
Any help would be greatly appreciated, (Flash Mx6)

Cheers!

try this:

onClipEvent (load) {
speed = 3;
this._y = 50;
}
onClipEvent (enterFrame) {
if (this._y<300) {
this._y += (targetdesired- this._y)/speed;
//replace targetdesired with where u want ur rectangle to be placed
}
}

i hope it helps :slight_smile:

Thanks for your help g-shock I’ll give it a go.