What I have can be thought of as two layers. One layer is like a filmstrip that slides using scrollRect for smooth scrolling. The bottom layer is static images in frames.
When the user swipes the filmstrip it moves left or right on the screen. When it stops it is told to be non visible and the static image is then shown.
All this works fine when swiping LEFT… the filmstrip slides over the next image, says move the the next frame, hides itself, and then the static image is shown. The problem is when I swipe RIGHT. If I put “prevFrame” in the code below it will not work. If I take it out the filmstrip works as expected, moving backwards, but the frames move to nextFrame.
Any ideas?
TIA
var ind:int = 0;
var currX:Number = 0;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener(Event.ENTER_FRAME, loop);
stage.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe);
function onSwipe(e:TransformGestureEvent):void {
if(e.offsetX == 1 && ind > 0) // SWIPE RIGHT//////////////////////
ind--;
sp.visible = true;
//prevFrame(); // I HAVE TO COMMENT THIS OUT OR IT WON'T PROGRESS, IT SEEMS LIKE IT IS A LOOP/////////////
_readitmyselfBtn.visible = false;
_readtomeBtn.visible = false;
_infoBtn.visible = false;
Tweener.addTween(sp, {time:1, onComplete:hideScroller});
if(e.offsetX == -1 && ind < 17) // SWIPE LEFT////////////////////
ind++;
sp.visible = true;
nextFrame();
_readitmyselfBtn.visible = false;
_readtomeBtn.visible = false;
_infoBtn.visible = false;
Tweener.addTween(sc, {_sound_volume:0, time:1.5, transition: "linear"});
Tweener.addTween(sp, {time:1, onComplete:hideScroller});
}
function hideScroller(){
sp.visible = false;
}
function loop(e:Event):void
{
currX += (ind * 1024 - currX) * 0.10;
sp.scrollRect = new Rectangle(currX, 0, 1024, 768);
}