views:

234

answers:

1

This is the setup. I have created a timeline with a playhead. When my playhead is dragged I would like the timeline to scroll with the drag.

So far, the only way I can do this is by setting clipAndEnableScrolling to true. But in this case I lose the scrollbars(not to mention the impact on my view). So what I would like is to set this property to false and dynamically affect the horizontal scrollbar's position, in other words enable scrolling without the clipping.

Any ideas?

A: 

The answer to his is to use the an HScollBar component. The presence of one seems to override the default scrollbar and then it's just a matter of updating it's value property on an event. In my case, MOUSE_MOVE does the trick:

private function onMouseMove(e:MouseEvent) {
       hScroll.value = playhead.x;
}
    <s:Group>
     ...

    <s:HScrollBar id="hScroll" viewport="{this}" width="{contentWidth}" bottom="0" >

    </s:HScrollBar>
    </s:Group>

This is of course very simplified and will require tweaking to get the feel right. But this should be a step in the right direction.

Tarek