Hello there and thanks in advanced to trying to help.
I’m busy making a page scrollbar with the code below. All visable stuff is on stage. But when i render the movieclip the bar isnt working at all
- selecting the dragger doesnt seem to work (on click function doesnt work)
- cant drag the dragger down.
- thus no scrolling
the fla is 9 mb so i didnt add it. the size is due to local pics whom will be replaced with dynamic content when the scrolling is fixed
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import caurina.transitions.Tweener;
var bounds:Rectangle;
var startY:Number;
var contentY:Number;
addEventListener(Event.[COLOR=red]AD[/COLOR][COLOR=red]DED_TO_STAGE[/COLOR], init); //change code below
function init(e:Event):void {
removeEventListener(Event.[COLOR=red]ADDED_TO_STAGE[/COLOR], init); //changed code below
scrollHandle.addEventListener(MouseEvent.MOUSE_DOWN, drag);
scrollBar.addEventListener(MouseEvent.CLICK, tween);
addEventListener(Event.ENTER_FRAME, moveBox);
startY = scrollHandle.y;
contentY = scrollingContent.y;
bounds = new Rectangle([COLOR=red]scrollHandle.x, scrollHandle.y, scrollBar.height - (scrollHandle.height + 2), 0[/COLOR]); //changed code below
}
function tween(e:MouseEvent):void {
var mousePos:Number = mouseY;
if(mousePos > (scrollBar.y + scrollBar.height) - (scrollHandle.height + 2)){
mousePos = (scrollBar.y + scrollBar.height) - (scrollHandle.height + 2);
}
Tweener.addTween(scrollHandle, {y: mousePos, time: 1});
}
function drag(e:MouseEvent):void {
scrollHandle.startDrag(false, bounds);
scrollHandle.gotoAndStop(2);
scrollHandle.removeEventListener(MouseEvent.MOUSE_DOWN, drag);
addEventListener(MouseEvent.MOUSE_UP, stopdrag);
}
function stopdrag(e:MouseEvent):void {
scrollHandle.stopDrag();
scrollHandle.gotoAndStop(1);
scrollHandle.addEventListener(MouseEvent.MOUSE_DOWN, drag);
removeEventListener(MouseEvent.MOUSE_UP, stopdrag);
}
function moveBox(e:Event):void {
scrollingContent.y = -((contentY - startY) + scrollHandle.y) * ((scrollingContent.height - masker.height) / (scrollBar.height - scrollHandle.height));
}