Resize menu

This is the origional that I started out with.
http://www.breefield.com/flash/slidingBarsOrig.html

This is the other version with diffrent sized objects to show some dynamic content.
http://www.breefield.com/flash/slidingBars.html

If anyone wants the source just ask.
This can be easily changed to make the bars buttons or links, etc. You can chage some things and make it resize totally diffrent.
I think I’m going to make a bounce version later.

I know this is kinda like a recent thread but I thought I’d share mine since it was a little diffrent.
The code isn’t exactly as clean as it could be and there are no comments, but it works :slight_smile:

Code



//Start expansion

//scale is the ammount the blocks expand by, larger number = more expansion.
scale = 4;

//speed controlls how fast the block resize on the way out, lower = faster.
speed = 3;

//speed2 controlls how fast the block come back in, lower = faster.
speed2 = 5;

//number of bars
ammount = 20;

//********************************
/*this next part of code is only used when you want to duplicate an object in the library over and over, if you want 
to use Movie Clips that are already on the stage then you'll need to position them and add their names to the holders
array manualy. */

holders = new Array;

for(i = 0; i <10; i++){
    var tempMC:MovieClip = holder.attachMovie("hol", "hold" + i, i, {_y: holders[i-1]._y + holders[i-1]._height + 1});
    
    holders.push(tempMC);
    
    rescale(tempMC, i);
}

//********************************

//creates a movieClipNamestartX variable that holds every clips starting position for later.
for(i = 0; i < holders.length; i++){
    _root[holders* + "startX"] = holders*._y;
}

//your own your own through here >.<
function rescale(mC, startNum){
    
    var origionalWidth = mC._width;
    var origionalHeight = mC._height;
    var endWidth = origionalWidth*scale;
    var endHeight = origionalHeight*scale;
    
    mC.onRollOver = function(){
        
        delete this.onEnterFrame;
        this.onEnterFrame = function(){
            
            mC._width += (endWidth - mC._width) / speed;
            mC._height += (endHeight - mC._height) / speed;
            
            for(i = startNum + 1; i < holders.length; i++){
                
                holders*._y = holders[i-1]._y + holders[i-1]._height + 1;
            }
            
            if(mC._width >= endWidth-2){
                
                delete this.onEnterFrame;
                mC._width = endWidth;
                mC._height = endHeight;
                
                for(i = startNum + 1; i < holders.length; i++){
                    holders*._y = holders[i-1]._y + holders[i-1]._height + 1;
                }
            }
        }
    }
    mC.onRollOut = function(){
        
        delete this.onEnterFrame;
        this.onEnterFrame = function(){
            
            mC._width -= (mC._width - origionalWidth) / speed2;
            mC._height -= (mC._height - origionalHeight) / speed2;
            
            for(i = startNum + 1; i < holders.length; i++){
                holders*._y = holders[i-1]._y + holders[i-1]._height + 1;
            }
            
            if(mC._width <= origionalWidth+2){
                delete this.onEnterFrame;
                mC._width = origionalWidth;
                mC._height = origionalHeight;
                
                for(i = startNum + 1; i < holders.length; i++){
                    holders*._y = holders[i-1]._y + holders[i-1]._height + 1;
                }
            }
        }
    }
}