-
make a standard thumb scroller / scroll infinitely
I've got a standard horizontal thumbnail scroller and want to have it scroll infinitely. So when it reaches the last one in the list from the xml it continues to show thumbnails starting over with the first... alternately when it starts and a user chooses to scroll in the other direction it shows the last one and progresses toward the first...
hopefully that makes sense.
I load the thumbs via xml here:
PHP Code:
function urlLoaded(event:Event):void { xml = XML(event.target.data); xmlList = xml.children(); for (var i:int=0; i < xmlList.length(); i++) { var thumb:Thumbnail = new Thumbnail(xmlList[i].url); arrayThumb.push(thumb); thumbNail.push(arrayThumb); arrayThumb[i].y = 0; arrayThumb[i].x = 10+(150*i); photoContainer.addChild(thumb); }
}
then when one of my arrows to navigate left or right, i check to see if reaches the end and if it does I bounce it back to 0. which is what the onComplete event calls to and passes the max positions, in the checkPos function if the argument is true it Tweens all back to 0, but I'd rather just continue looping on through...
PHP Code:
function moveRight(e:MouseEvent):void{ var maxRight:Number = - photoContainer.width + stage.stageWidth; if(photoContainer.x < maxRight){ // do nada }else{ Tweener.addTween(photoContainer,{x:photoContainer.x-300, transition:"easeInOutBack", time:1.5, onComplete:checkPos, onCompleteParams:[maxLeft,maxRight]}); } }
any suggestions
Last edited by knottyDJ; 11-25-2008 at 07:07 PM.
-
one more thing.
once the onComplete runs checkPos:
PHP Code:
function checkPos(maxLeft,maxRight){
if(photoContainer.x < maxRight){
Tweener.addTween(photoContainer,{x:photoContainer.x+10, transition:"easeInOutBack", time:1.5});
}else if(photoContainer.x > maxLeft-150){
Tweener.addTween(photoContainer,{x:0, transition:"easeInOutBack", time:1.5});
}else{
trace("DOING NOTHING END NOT YET REACHED");
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|