Hi there and happy new year to everyone. I just signed up btw.
Here's my problem:
I found the scroll panel the was posted by carlschooff. Here's the link: forums.greensock.com/topic/5927-a-better-solution-throwprops-please-help/#entry20981
and modified it's code so i could vertically scroll the panels instead.
Everything works except one annoying thing. When i scroll from top to bottom sometimes i'll get a sketchy effect like the panel is trying to move on the x axis instead of staying fixed like i want.
I haven't found a way to fix this yet.
As you will see i'm trying to give the _container.x a constant position of -11.1
public class scroll extends MovieClip{
private var _panelBounds:Rectangle = new Rectangle(0,0,822,480);
public var _container:MovieClip;
public var clients_btns:MovieClip;
private var _currentPanelIndex:int = 0;
private var _panelCount:int;
private var _y1:Number;
private var _y2:Number;
private var _t1:uint;
private var _t2:uint;
public function scroll(){
_panelCount = 5;
_container.y = _panelBounds.y;
_container.x = -11.1;
clients_btns.x = -11.1;
clients_btns.y = _panelBounds.y;
addChildAt(_container, 26);
addChildAt(clients_btns, 27);
_container.addEventListener(MouseEvent.MOUSE_DOWN, _mouseDownHandler, false, 0, true);
}
private function _mouseDownHandler(event:MouseEvent):void{
TweenLite.killTweensOf(_container);
TweenLite.killTweensOf(clients_btns);
_y1 = _y2 = this.mouseY;
_t1 = _t2 = getTimer();
_container.startDrag();
this.stage.addEventListener(MouseEvent.MOUSE_UP, _mouseUpHandler, false, 0, true);
this.addEventListener(Event.ENTER_FRAME, _enterFrameHandler, false, 0, true);
}
private function _enterFrameHandler(event:Event):void{
_y2 = _y1;
_t2 = _t1;
_y1 = this.mouseY;
_t1 = getTimer();
_container.x = -11.1;
clients_btns.x = -11.1;
}
private function _mouseUpHandler(event:MouseEvent):void{
_container.stopDrag();
clients_btns.stopDrag();
this.removeEventListener(Event.ENTER_FRAME, _enterFrameHandler);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, _mouseUpHandler);
var elapsedTime:Number = (getTimer() - _t2) / 1000;
var yVelocity:Number = (this.mouseY - _y2) / elapsedTime;
if (_currentPanelIndex > 0 && (yVelocity > 2 || _container.y > (_currentPanelIndex - 0.5) * -_panelBounds.height + _panelBounds.y))
{
_currentPanelIndex--;
}
else if (_currentPanelIndex < _panelCount - 1 && (yVelocity < -2 || _container.y < (_currentPanelIndex + 0.5) * -_panelBounds.height + _panelBounds.y))
{
_currentPanelIndex++;
}
TweenLite.to(_container, 1.2, {x:-11.1, y:_currentPanelIndex * -_panelBounds.height + _panelBounds.y, ease:Strong.easeOut});
_container.x = -11.1;
TweenLite.to(clients_btns, 1.2, {x:-11.1, y:_currentPanelIndex * -_panelBounds.height + _panelBounds.y, ease:Strong.easeOut});
clients_btns.x = -11.1;
}
}
Thanks for your time.