Hello,
I’m working on the Kirupa scroller tutorial here
I’ve tried to customize it as best as I could and added Tweener to have an effect on the content being scrolled (contentMain as it’s instanced in the tut)
Now I’m trying to go full screen but there is a bug…
the scroll bar (scrollFace) works fine until the window is resized, when moved, it returns to it’s first ._x position it had on window open.
I’ve tried pasting scrollFace._x = scrollTrack._x; at different places but it doesn’t work:bucktooth:
here’s the code
import caurina.transitions.Tweener;
//initial placements
maskedView._x = Stage.width/2;
maskedView._y = Stage.height/2;
contentMain._x = Stage.width/2;
scrollTrack._x = Stage.width-20;
scrollTrack._yscale = Stage.height;
scrollFace._x = scrollTrack._x;
// resize
var stageL:Object = new Object();
stageL.onResize = function() {
maskedView._x = Stage.width/2;
maskedView._y = Stage.height/2;
contentMain._x = Stage.width/2;
scrollTrack._x = Stage.width-20;
scrollTrack._yscale = Stage.height;
scrollFace._x = scrollTrack._x;
};
Stage.addListener(stageL);
scrolling = function () {
var scrollHeight:Number = scrollTrack._height;
var contentHeight:Number = contentMain._height;
var scrollFaceHeight:Number = scrollFace._height;
var maskHeight:Number = maskedView._height;
var initPosition:Number = scrollFace._y=scrollTrack._y;
var initContentPos:Number = contentMain._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
var left:Number = scrollTrack._x;
var top:Number = scrollTrack._y;
var right:Number = scrollTrack._x;
var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y;
var dy:Number = 0;
var speed:Number = 10;
var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-scrollFaceHeight);
scrollFace.onPress = function() {
var currPos:Number = this._y;
startDrag(this, false, left, top, right, bottom);
this.onMouseMove = function() {
dy = Math.abs(initPosition-this._y);
Tweener.addTween(contentMain, {_y:Math.round(dy*-1*moveVal+initContentPos), time:0.2, transition:"Linear"});
};
};
scrollFace.onMouseUp = function() {
stopDrag();
delete this.onMouseMove;
};
};
Please help me understand what I’m missing here:te: