Function problems

okay heres my deal, im trying to create my first function and then calling it, but nothing is happening.

heres my function: (on frame 1 of a seperate layer)

function movePics(newPos, rate2) {
currentY2 = this._y;
distance2 = newPos-currentY2;
move2 = distance2/rate2;
this._y = currentY2+move2;
}

and heres where i call the function: (located on a button of course)

on (release) {
_root.pic.pics.movePics(500,4);
}

so, at run time i press the button and nothing happens to that instance? any help would be much appreciated

You can’t use “this” in a function… Try something like this…


function movePics(mc, newPos, rate2) {
currentY2 = mc._y;
distance2 = newPos-currentY2;
move2 = distance2/rate2;
mc._y = currentY2+move2;
}

on (release) {
_root.movePics(_root.pic.pics, 500,4);
}