I have the following clipEvent to control a scrolling menu:
onClipEvent (load) {
xcenter = 250;
speed = 1/15;
}
onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
_x -= (distance*speed);
if (_x>0) {
_x = -500;
}
if (_x<-500) {
_x = 0;
}
}
How can I make this into a function ?