A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: make a standard thumb scroller / scroll infinitely

  1. #1
    Senior Member
    Join Date
    Feb 2006
    Location
    Portland OR
    Posts
    138

    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=0xmlList.length(); i++) {
            var 
    thumb:Thumbnail = new Thumbnail(xmlList[i].url);
            
    arrayThumb.push(thumb);
            
    thumbNail.push(arrayThumb);
            
    arrayThumb[i].0;
            
    arrayThumb[i].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.maxRight){
                     
    // do nada
            
    }else{
            
    Tweener.addTween(photoContainer,{x:photoContainer.x-300transition:"easeInOutBack"time:1.5onComplete:checkPosonCompleteParams:[maxLeft,maxRight]});
        }

    any suggestions
    Last edited by knottyDJ; 11-25-2008 at 07:07 PM.

  2. #2
    Senior Member
    Join Date
    Feb 2006
    Location
    Portland OR
    Posts
    138
    one more thing.
    once the onComplete runs checkPos:

    PHP Code:
    function checkPos(maxLeft,maxRight){
        if(
    photoContainer.maxRight){
        
    Tweener.addTween(photoContainer,{x:photoContainer.x+10transition:"easeInOutBack"time:1.5});
        }else if(
    photoContainer.maxLeft-150){
        
    Tweener.addTween(photoContainer,{x:0transition:"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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center