Problem with nested code

Howdy,

I am relatively new to actionscrip. I know just enough to be dangerous.

I have a movieclip that is an interactive “timeline” (a graphical timeline, not timeline in flash workspace). You click and drag a sliding button across the timeline and have a slide pop in and another pop out based on where on the “timeline” you drag the sliding button. (see pix)

For the slider, I have a variable called “dragging” It evaluates at true when being dragged.

The buttons are on the same _level.* as the sliding handle. So, I want the buttons to do their thing (slide each slide in) only if the slider is being dragged. The “timelinestate” variable is so it knows which slide to slide out depending on which slide I was on last. (hence the redefinition of timelinestatus at the end.) The output window gives me errors I’ve posted afer the code.

if (dragging) {
if (timelinestate == 3) {
on (rollOver) {
_root.Scan_System.Content.Content_Bio.Timeline.Timeline_Pix.Bio_Pix3_Slide.gotoAndPlay(“Slide_Out”);
_root.Scan_System.Content.Content_Bio.Timeline.Timeline_Pix.Bio_Pix4_Slide.gotoAndPlay(“Slide_In”);
}
}
if (timelinestate == 5) {
on (rollOver) {
_root.Scan_System.Content.Content_Bio.Timeline.Timeline_Pix.Bio_Pix5_Slide.gotoAndPlay(“Slide_Out”);
_root.Scan_System.Content.Content_Bio.Timeline.Timeline_Pix.Bio_Pix4_Slide.gotoAndPlay(“Slide_In”);
}
}
}
timelinestate = 4;

//Error messgage that appears//:

Symbol=TimeLine, Layer=Buttons, Frame=1: Line 1: Statement must appear within on handler
if (dragging) {

Symbol=TimeLine, Layer=Buttons, Frame=1: Line 15: Statement must appear within on handler
timelinestate = 4;

Any help would be greatly appreciated >;-}

Tom