Hi,
Not sure how many questions get asked about flash these days but I have one. I have having issues on scrolling using the code below. It works but but its slow. I am thinking a "blitmask" would work great here but I don't know where I would put it. Can you give me some tips?
Thanks
-Ed
/// SCROLL BAR
///////////////////////
public function throwIt(clipContent:MovieClip)
{
// old code
//var bounds:Rectangle = new Rectangle(_screenX - clipContent.width,0,_screenX,_screenY);
// custom var
var bounds:Rectangle = new Rectangle(0,0,_screenX,_screenY);
//var mc:Sprite = meow.getChildByName("content") as MovieClip;
var mc:Sprite = clipContent as MovieClip;
addChild(mc);
//some variables for tracking the velocity of mc
var t1:uint,t2:uint,y1:Number,y2:Number;
mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void
{
TweenLite.killTweensOf(mc);
y1 = y2 = mc.y;
t1 = t2 = getTimer();
mc.startDrag(false, new Rectangle(bounds.x, -99999, 0, 99999999));
mc.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
mc.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
function enterFrameHandler(event:Event):void
{
//track velocity using the last 2 frames for more accuracy
y2 = y1;
t2 = t1;
y1 = mc.y;
t1 = getTimer();
}
function mouseUpHandler(event:MouseEvent):void
{
mc.stopDrag();
mc.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
mc.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
var time:Number = (getTimer() - t2) / 1000;
var yVelocity:Number = (mc.y - y2) / time;
var yOverlap:Number = Math.max(0,mc.height - bounds.height);
ThrowPropsPlugin.to(mc, {ease:Strong.easeOut, throwProps:{y:{velocity:yVelocity, max:bounds.top , min:bounds.top - yOverlap - (littleLogo.height + littleLogo.height/3) , resistance:777}}}, 33, 0.25, .3);
}
}
//////////////////
/// end SCROLL/////////////