I downloaded the oringe blur scrollbar a while back and I am using it for a project of mine but I don’t know alot of actionscript. I someone could help out it would be great!
The scrollbar scrolls the contents in the “main” movieclip. I added alot of items but it only scrolls down a little bit when I use the scroll but if I use the wheel on my actual mouse it goes down all the way. Does anyone know why?
Here is the code:
//////////////////////////////////////////////////////////////////////
//MODIFY the below variables to suit your needs:
//
//set your flash stage width here:
initStageWidth = 750;
//
//set how many pixels you want your content to move when you move
//the mousewheel here:
mouseWheelIncrement = 50;
//////////////////////////////////////////////////////////////////////
//DO NOT TOUCH the below code
//unless, of course, you want to change the script and
//workings of this code.
////////////////////////////
//import the blur filter (requires Flash 8 & actionscript 2)
import flash.filters.BlurFilter;
blur = new BlurFilter(0, 10, 1);
////////////////////////////
//create a listener for the mouse wheel so the mouse wheel works
mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
if (delta < 0) {
mainTargetY -= mouseWheelIncrement;
if (mainTargetY < Stage.height - main._height) {
mainTargetY = Stage.height - main._height;
}
}
if (delta > 0) {
mainTargetY += mouseWheelIncrement;
if (mainTargetY > mainInitY) {
mainTargetY = mainInitY;
}
}
}
Mouse.addListener(mouseListener);
////////////////////////////
//actions for scrollbar
//first init some frequently used variables
mainInitY = main._y;
scrollbarInitY = scrollbar.scrollbutton._y;
scrollOn = false;
mainTargetY = mainInitY;
scrollbarTargetY = scrollbarInitY;
//don't want to use hand cursor for scrollbar
scrollbar.scrollbutton.useHandCursor = false;
//actions for scrollbar button behavior
scrollbar.scrollbutton.onRollOver = function() {
if (!scrollOn) {
this.gotoAndPlay("over");
}
}
scrollbar.scrollbutton.onDragOver = scrollbar.scrollbutton.onRollOver;
scrollbar.scrollbutton.onRollOut = function() {
this.gotoAndPlay("out");
}
scrollbar.scrollbutton.onPress = function() {
scrollOn = true;
this.startDrag(false, this._x, scrollbarInitY, this._x, scrollbarInitY + scrollAreaHeight );
}
scrollbar.scrollbutton.onMouseUp = function() {
if (scrollOn) {
scrollOn = false;
this.stopDrag();
if (!scrollbar.scrollbutton.hitTest(_xmouse, _ymouse)) {
scrollbar.scrollbutton.gotoAndPlay("out");
}
}
}
//this is where the animation happens, within this function:
scrollbar.scrollbutton.onEnterFrame = function() {
if (scrollOn) {
mainTargetY = mainInitY-(main._height-Stage.height)*(scrollbar.scrollbutton._y - scrollbarInitY)/scrollAreaHeight;
} else {
scrollbarTargetY = -(main._y - mainInitY)*scrollAreaHeight/(main._height - Stage.height) + scrollbarInitY;
if (Math.abs(scrollbar.scrollbutton._y - scrollbarTargetY) > 0.2) {
scrollbar.scrollbutton._y += (scrollbarTargetY - scrollbar.scrollbutton._y)/2;
}
}
if (Math.abs(main._y - mainTargetY) > 0.2) {
//this is where we calculate the blur distance
mainOldY = main._y;
main._y += Math.ceil((mainTargetY - main._y)/2);
mainMovement = mainOldY - main._y;
//we flur the blur distance for performance gains
//(in theory, at least; this hasn't been tested)
blur.blurY = Math.floor(Math.abs(mainMovement));
main.filters = [blur];
}
}
////////////////////////////////////
//actions for stage resizing
Stage.align = "LT";
Stage.scaleMode = "noScale";
resizer = new Object();
resizer.onResize = function () {
scrollbar._x = Math.ceil(Stage.width - scrollbar._width);
scrollAreaHeight = Stage.height - scrollbarInitY*2 - scrollbar.scrollbutton._height;
icons_bottom._x = Math.ceil(Stage.width - icons_bottom._width);
}
Stage.addListener(resizer);
resizer.onResize();