A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: using modulus to loop thumbnails

Threaded View

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    4

    Question using modulus to loop thumbnails

    I'm still pretty novice when it comes to as3 and am trying to use modulus to loop 14 thumbnails in an array.

    i have a property called firstThumb that keeps track of the first thumbnail being displayed and a forward and back function that looks like this

    PHP Code:
    private function reverseThumbs(e:MouseEvent):void
            
    {
                
    trace("moving back");
                
    displayThumbs(firstThumb-1DISPLAYED);
                
                
    //update our pointer to the first thumb to display
                
                
                
    firstThumb--;
                
        } 
    PHP Code:
    private function advanceThumbs(e:MouseEvent):void
            
    {
                
    trace("moving forward");
                
    displayThumbs(firstThumb+1DISPLAYED);;
                
                
    //update our pointer to the first thumb to display
                
                
                
    firstThumb++;
                
                
            } 

    i also have a position counter to keep track of the thumbnails being displayed
    PHP Code:
    //display some of the thumbs in the thumbarray
            
    private function displayThumbs (aStart,howMany:int):void
            
    {
                
                
    //13%14 modulus 
                //get rid any thumbs already displayed
                
    for (var firstThumbfirstThumb+DISPLAYEDn++) 
                {
                    
                    
                    
    //remove the thumb if it is in the displaylist
                    
    if (this.contains(thumbArray[n])) removeChild(thumbArray[n]);
                    
                }
                
                
    //then display the current four
                
    var posCounter:int =0;
                for (var 
    aStartaStart+howManyi++)
                
                {
                    
    addChildthumbArray[i] );
                    
    thumbArray[i].45;
                    
    thumbArray[i].150 +posCounter*(thumbArray[i].width MARGIN);
                    
    posCounter++;
                }
                
            } 
    if anyone has any suggestions for how i can go about using modulus to loop the images through, itd be great
    Last edited by tonyxspote; 04-07-2009 at 04:01 PM.

Tags for this Thread

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