Horizontal drag scroller with zoom - im stumped

i’ve been putting this together and ran into a wall. I’m having a few issues that i just can’t seem to figure out.

I’d like to have this drag scroller drag left and right.
-Got that.

I’d also like to have it zoom in/out according to where the mouse has been clicked. i.e. zoom to the mouse when clicked.
-Kind of got that

I would also like to be able to scroll left/right while it’s zoomed in or out
-kind of got that

as a bonus, it would be nice to get the original blur working as well, but thats just an extra

the fla is**** attached. The code is below…It’s based on the oringe blur scrollbar

[COLOR=#f000f0]*#include "mc_tween2.as"*[/COLOR]

hand.[COLOR=#993300]onEnterFrame[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]this[/COLOR].[COLOR=#993300]_x[/COLOR] = [COLOR=#993300]_xmouse[/COLOR];
    [COLOR=#993300]this[/COLOR].[COLOR=#993300]_y[/COLOR] = [COLOR=#993300]_ymouse[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#f000f0]*//first init some frequently used variables*[/COLOR]

mainInitX = main.[COLOR=#993300]_x[/COLOR];
scrollbarInitX = main2.[COLOR=#993300]_x[/COLOR];
scrollOn = [COLOR=#993300]false[/COLOR];
mainTargetX = mainInitX;
scrollbarTargetX = scrollbarInitX;
[COLOR=#f000f0]*//don't want to use hand cursor for scrollbar*[/COLOR]
main2.[COLOR=#993300]useHandCursor[/COLOR] = [COLOR=#993300]false[/COLOR];

[COLOR=#f000f0]*//actions for scrollbar button behavior*[/COLOR]
main2.[COLOR=#993300]onRollOver[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]Mouse[/COLOR].[COLOR=#993300]hide[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#993300]_root[/COLOR].[COLOR=#000000]hand[/COLOR].[COLOR=#993300]_visible[/COLOR] = [COLOR=#993300]true[/COLOR];
    [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]!scrollOn[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]

        [COLOR=#993300]this[/COLOR].[COLOR=#993300]gotoAndPlay[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"over"[/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
main2.[COLOR=#993300]onDragOver[/COLOR] = main2.[COLOR=#993300]onRollOver[/COLOR];
main2.[COLOR=#993300]onRollOut[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]Mouse[/COLOR].[COLOR=#993300]show[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#993300]_root[/COLOR].[COLOR=#000000]hand[/COLOR].[COLOR=#993300]_visible[/COLOR] = [COLOR=#993300]false[/COLOR];
    [COLOR=#993300]this[/COLOR].[COLOR=#993300]gotoAndPlay[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"out"[/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000]}[/COLOR];
main2.[COLOR=#993300]onPress[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#f000f0]*//get mouse position*[/COLOR]
    downmouse = [COLOR=#993300]_root[/COLOR].[COLOR=#993300]_xmouse[/COLOR];
    [COLOR=#993300]_root[/COLOR].[COLOR=#000000]hand[/COLOR].[COLOR=#993300]nextFrame[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#993300]this[/COLOR].[COLOR=#993300]startDrag[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    scrollOn = [COLOR=#993300]true[/COLOR];
    [COLOR=#993300]this[/COLOR].[COLOR=#993300]startDrag[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]false[/COLOR],-[COLOR=#000000]([/COLOR]scrollbarInitX+scrollAreaWidth[COLOR=#000000])[/COLOR],[COLOR=#993300]this[/COLOR].[COLOR=#993300]_y[/COLOR],-[COLOR=#000000]([/COLOR]scrollbarInitX[COLOR=#000000])[/COLOR],[COLOR=#993300]this[/COLOR].[COLOR=#993300]_y[/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR]downmouse[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR];
main2.[COLOR=#993300]onReleaseOutside[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]Mouse[/COLOR].[COLOR=#993300]show[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#993300]_root[/COLOR].[COLOR=#000000]hand[/COLOR].[COLOR=#993300]_visible[/COLOR] = [COLOR=#993300]false[/COLOR];

    [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]scrollOn[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
        scrollOn = [COLOR=#993300]false[/COLOR];
        [COLOR=#993300]this[/COLOR].[COLOR=#993300]stopDrag[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]!main2.[COLOR=#000000]Row1[/COLOR].[COLOR=#993300]hitTest[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]_xmouse[/COLOR], [COLOR=#993300]_ymouse[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
            [COLOR=#993300]_root[/COLOR].[COLOR=#000000]hand[/COLOR].[COLOR=#993300]_visible[/COLOR] = [COLOR=#993300]false[/COLOR];
        [COLOR=#000000]}[/COLOR]
    [COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
enlarged = [COLOR=#993300]false[/COLOR];
expanded = [COLOR=#993300]false[/COLOR];
RowHeight = [COLOR=#993300]Stage[/COLOR].[COLOR=#993300]height[/COLOR]/[COLOR=#000000]5[/COLOR];
main.[COLOR=#993300]_height[/COLOR] = RowHeight;
main.[COLOR=#993300]_xscale[/COLOR] = main.[COLOR=#993300]_yscale[/COLOR];
newHeight = [COLOR=#993300]Stage[/COLOR].[COLOR=#993300]height[/COLOR]/[COLOR=#000000]2[/COLOR];
prop = main.[COLOR=#993300]_width[/COLOR]/main.[COLOR=#993300]_height[/COLOR];
newWidth = newHeight*prop;

main2.[COLOR=#993300]onMouseUp[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    upmouse = [COLOR=#993300]_root[/COLOR].[COLOR=#993300]_xmouse[/COLOR];
    [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR]enlarged[COLOR=#000000])[/COLOR];
    [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]([/COLOR]upmouse<downmouse+[COLOR=#000000]10[/COLOR][COLOR=#000000])[/COLOR] && [COLOR=#000000]([/COLOR]upmouse>downmouse-[COLOR=#000000]10[/COLOR][COLOR=#000000])[/COLOR]&&[COLOR=#000000]([/COLOR]enlarged == [COLOR=#993300]false[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR]  [COLOR=#000000]{[/COLOR]
        enlarged = [COLOR=#993300]true[/COLOR];
        main.[COLOR=#000000]tween[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"_x"[/COLOR],[COLOR=#000000]([/COLOR]-[COLOR=#000000]([/COLOR][COLOR=#000000]([/COLOR]upmouse/main.[COLOR=#993300]_width[/COLOR][COLOR=#000000])[/COLOR]*newWidth[COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR]+upmouse,.[COLOR=#000000]5[/COLOR][COLOR=#000000])[/COLOR];
        main.[COLOR=#000000]tween[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"_width"[/COLOR],newHeight*prop,.[COLOR=#000000]5[/COLOR][COLOR=#000000])[/COLOR];
        main.[COLOR=#000000]tween[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"_height"[/COLOR],newHeight,.[COLOR=#000000]5[/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR] 
    [COLOR=#993300]else[/COLOR] [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]([/COLOR]upmouse<downmouse+[COLOR=#000000]10[/COLOR][COLOR=#000000])[/COLOR] && [COLOR=#000000]([/COLOR]upmouse>downmouse-[COLOR=#000000]10[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
        enlarged = [COLOR=#993300]false[/COLOR];
        main.[COLOR=#000000]tween[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"_x"[/COLOR],-[COLOR=#000000]([/COLOR][COLOR=#000000]([/COLOR]upmouse/main.[COLOR=#993300]_width[/COLOR][COLOR=#000000])[/COLOR]*newWidth[COLOR=#000000])[/COLOR],.[COLOR=#000000]5[/COLOR][COLOR=#000000])[/COLOR];
        main.[COLOR=#000000]tween[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"_width"[/COLOR],[COLOR=#993300]_root[/COLOR].[COLOR=#000000]RowHeight[/COLOR]*prop,.[COLOR=#000000]5[/COLOR][COLOR=#000000])[/COLOR];
        main.[COLOR=#000000]tween[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"_height"[/COLOR],[COLOR=#993300]_root[/COLOR].[COLOR=#000000]RowHeight[/COLOR],.[COLOR=#000000]5[/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR]
    [COLOR=#993300]_root[/COLOR].[COLOR=#000000]hand[/COLOR].[COLOR=#993300]prevFrame[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#993300]stopDrag[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]scrollOn[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
        scrollOn = [COLOR=#993300]false[/COLOR];
        [COLOR=#993300]this[/COLOR].[COLOR=#993300]stopDrag[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
        [COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]!main2.[COLOR=#993300]hitTest[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]_xmouse[/COLOR], [COLOR=#993300]_ymouse[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
            [COLOR=#f000f0]*//scrollbar.scrollbutton.gotoAndPlay("out");*[/COLOR]
        [COLOR=#000000]}[/COLOR]
    [COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];

[COLOR=#f000f0]*//this is where the animation happens, within this function:*[/COLOR]
main2.[COLOR=#993300]onEnterFrame[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    
[COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]scrollOn[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]

mainTargetX = -[COLOR=#000000]([/COLOR]mainInitX-[COLOR=#000000]([/COLOR]main._width-[COLOR=#993300]Stage[/COLOR].[COLOR=#993300]width[/COLOR][COLOR=#000000])[/COLOR]*[COLOR=#000000]([/COLOR]main2._x-scrollbarInitX[COLOR=#000000])[/COLOR]/scrollAreaWidth[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#993300]else[/COLOR] [COLOR=#000000]{[/COLOR]

scrollbarTargetX = -[COLOR=#000000]([/COLOR]main._x-mainInitX[COLOR=#000000])[/COLOR]*scrollAreaWidth/[COLOR=#000000]([/COLOR]main._width-[COLOR=#993300]Stage[/COLOR].[COLOR=#993300]width[/COLOR][COLOR=#000000])[/COLOR]+scrollbarInitX;
[COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#993300]Math[/COLOR].[COLOR=#993300]abs[/COLOR][COLOR=#000000]([/COLOR]main2._x-scrollbarTargetX[COLOR=#000000])[/COLOR]>[COLOR=#000000]0[/COLOR].[COLOR=#000000]2[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]

main2.[COLOR=#993300]_x[/COLOR] += -[COLOR=#000000]([/COLOR]scrollbarTargetX+main2.[COLOR=#993300]_x[/COLOR][COLOR=#000000])[/COLOR]/[COLOR=#000000]2[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#993300]Math[/COLOR].[COLOR=#993300]abs[/COLOR][COLOR=#000000]([/COLOR]main._x-mainTargetX[COLOR=#000000])[/COLOR]>[COLOR=#000000]2[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]

[COLOR=#f000f0]*//this is where we calculate the blur distance*[/COLOR]
mainOldX = main.[COLOR=#993300]_x[/COLOR];
main.[COLOR=#993300]_x[/COLOR] += [COLOR=#993300]Math[/COLOR].[COLOR=#993300]ceil[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]([/COLOR]mainTargetX-main.[COLOR=#993300]_x[/COLOR][COLOR=#000000])[/COLOR]/[COLOR=#000000]2[/COLOR][COLOR=#000000])[/COLOR];
mainMovement = mainOldX-main.[COLOR=#993300]_x[/COLOR];
[COLOR=#f000f0]*//we flur the blur distance for performance gains*[/COLOR]
[COLOR=#f000f0]*//(in theory, at least; this hasn't been tested)*[/COLOR]
[COLOR=#f000f0]*/*blur.blurX = Math.floor(Math.abs(mainMovement));
var f = main.filters;
f[1] = blur;
main.filters = f;*/*[/COLOR]


[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
resizer = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Object[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
resizer.[COLOR=#993300]onResize[/COLOR] = [COLOR=#993300]function[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#f000f0]*//scrollbar._y = Stage.height-scrollbar._height;*[/COLOR]
    scrollAreaWidth = [COLOR=#993300]Stage[/COLOR].[COLOR=#000000]width[/COLOR]-scrollbarInitX*[COLOR=#000000]2[/COLOR];
[COLOR=#000000]}[/COLOR];
[COLOR=#993300]Stage[/COLOR].[COLOR=#993300]addListener[/COLOR][COLOR=#000000]([/COLOR]resizer[COLOR=#000000])[/COLOR];

resizer.[COLOR=#993300]onResize[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];