Hi!
Is there anyone who knows how to modify the code below so that i can use the mouse wheel to scroll?
import com.greensock.TweenMax;
var CONTENT_HEIGHT:Number = 415.6;
var MASK_HEIGHT:Number = 250;
var oldY:Number = myContent.y;
myContent.x = myMask.x;
myContent.y = myMask.y;
myContent.mask = myMask;
var bounds:Rectangle = new Rectangle(scrollMC.x,scrollMC.y,0,250);
var scrolling:Boolean = false;
scrollMC.addEventListener(MouseEvent.MOUSE_DOWN, startScroll);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScroll);
function startScroll(e:Event):void {
scrolling = true;
scrollMC.startDrag(false,bounds);
}
function stopScroll(e:Event):void {
scrolling = false;
scrollMC.stopDrag();
}
addEventListener(Event.ENTER_FRAME, enterHandler);
function enterHandler(e:Event):void {
if (scrolling == true) {
var distance:Number = Math.round(scrollMC.y - bounds.y);
var percentage:Number = distance / MASK_HEIGHT;
oldY = myContent.y;
var targetY:Number = -((CONTENT_HEIGHT - MASK_HEIGHT) * percentage) + myMask.y;
if (Math.abs(oldY - targetY) > 5) {
TweenMax.to(myContent, 0.3, {y: targetY, blurFilter:{blurX:22, blurY:22}, onComplete: tweenFinished});
}
}
}
function tweenFinished():void {
TweenMax.to(myContent, 0.3, {blurFilter:{blurX:0, blurY:0}});
}