Slider code on main timeline moving movie clip issue

onClipEvent (load) {
MinX = 0;
MaxX = 200;
this._x=100;
FRAME = _root.p1;
}
onClipEvent (mouseMove) {
x = this._x-MinX;
y = MaxX-MinX;
FRAME.gotoAndStop(Math.round((xFRAME._totalframes)/y));
trace(Math.round((x
FRAME._totalframes)/y));
updateAfterEvent();
}
onClipEvent (mouseDown) {
this.startDrag(false, MinX, 0, MaxX, 0);
}
onClipEvent (mouseUp) {
stopDrag ();
}

p1 is the instance of the movie which I am trying to move with slider.
When I apply above code on the handle of the slider with instance name ‘handle’ everything works perfect. Slider moves and so do the movie.

Now instead when I bring the same code to the main timeline to do the same,
onClipEvent does not work, it gives error. So I replaced it with the code written below. Now I can move the handle but movie is not moving.

I think this portion of the code below is not working properly, as it is not updating the frames number as slider moves.

_root.p1.onMouseMove = function() {
x = 250-MinX;
y = MaxX-MinX;
FRAME.gotoAndStop(Math.round((x*FRAME._totalframes)/y));
updateAfterEvent();
}

Actual code on main timeline:

_root.c_mc.handle_mc.onLoad = function()
{
MinX = 0;
MaxX = 200;
this._x=100;
FRAME = _root.p1;
}
_root.p1.onMouseMove = function() {
x = 100-MinX;
y = MaxX-MinX;
FRAME.gotoAndStop(Math.round((x*FRAME._totalframes)/y));
updateAfterEvent();
}
_root.c_mc.handle_mc.onPress = function(){
_root.c_mc.handle_mc.startDrag(false, MinX, 0, MaxX, 0);
}
_root.c_mc.handle_mc.onRelease = function(){
_root.c_mc.handle_mc_mc.stopDrag ();
}

handle_mc is inside c_mc and c_mc is the instance of the whole slider.
handle_mc is the instance of the handle of the slider I am using to move the movie whose instance is p1.
handle of slider is in the middle and movie left and right horizontally

Can anybody please tell me where I am making a mistake on code on main timeline and how to fix it. I know I am making a small mistake somewhere.
Anybody???

this issue is resolved :slight_smile: