CLICK HERE TO COPY
Actionscript:
var prevBtn:Sprite = makeArrow(100, 100);
prevBtn.rotation = 180;
var nextBtn:Sprite = makeArrow(130, 100);
var index:int = 0;
var vals:Array = [1,2,3,4,5,6,7,8,9,10,11];
var leng:int = vals.length;
trace(vals[index]);
prevBtn.addEventListener(MouseEvent.CLICK, onPrev);
function onPrev(evt:MouseEvent):void {
index--;
if (index <0){
index = leng - 1;
}
trace(vals[index%leng]);
}
nextBtn.addEventListener(MouseEvent.CLICK, onNext);
function onNext(evt:MouseEvent):void {
index++;
trace(vals[index%leng]);
}
function makeArrow(xp:Number, yp:Number):Sprite {
[...]