labs.insert-title.com

Swish Resizer

The Flash

The Script

While this could most definitely be trimmed down, as a far as the amount of code, I was very tired of looking at it

	
function DrawBox(sName,s,fc,bc,w,h,x,y,dpth,opc){
    ref= this.createEmptyMovieClip(sName,dpth);    
    ref.lineStyle(0,0xFFFFFF,0);
    ref.moveTo(x,y);    
    ref.lineStyle(0,bc,10);
    ref.beginFill(fc,opc);
    ref.lineTo(x+w,y);
    ref.lineTo(x+w,y+h);
    ref.lineTo(x,y+h);
    ref.lineTo(x,y); 
    ref.endfill();
        ref.onEnterFrame = function(){
        this._X -= 250-(this._width/2);
        this._X *= 0.4;
        this._X += 250-(this._width/2);
                        
        this._Y -= 250-(this._height/2);               
        this._Y *= 0.4;               
        this._Y += 250-(this._height/2);                               
        }
     }
function setStage(){ 
    DrawBox("shadowBox",0,0x000000,0x000000,boxW,boxH,0.5,0.5,1,50);       
    DrawBox("whiteBox",1,0xffffff,0x000000,boxW-2,boxH-2,0,0,2,100);       
    DrawBox("contentBox",1,0xA24B30,0x000000,boxW-8,boxH-8,0,0,3,100);       
    }
onLoad(){
    movieH = 500;
    movieW = 500;
    movieXC = movieW/2;
    movieYC = movieH/2;
    boxH = 100;
    boxW = 300;
    boxX = movieXC-(boxW/2);
    boxY = movieYC-(boxH/2);    
    setStage();
    nWidth = 300;
    nHeight = 100;
    steps=10;
    }
onEnterFrame() {
        if (shadowBox._height < nHeight){
            shadowBox._height+=(nHeight/steps);
            contentBox._height+=(nHeight/steps);
            whiteBox._height+=(nHeight/steps);
        }
        if (shadowBox._height > nHeight){
            shadowBox._height-=(nHeight/steps);
            contentBox._height-=(nHeight/steps);
            whiteBox._height-=(nHeight/steps);
        }    
        if (shadowBox._width < nWidth){
            shadowBox._width+=(nWidth/steps);
            contentBox._width+=(nWidth/steps);
            whiteBox._width+=(nWidth/steps);
        }
        if (shadowBox._width > nWidth){
            shadowBox._width-=(nWidth/steps);
            contentBox._width-=(nWidth/steps);
            whiteBox._width-=(nWidth/steps);
        } 
    _root.ONE._X = shadowBox._X;
    _root.ONE._Y = shadowBox._Y-15;

    _root.TWO._X = shadowBox._X+50;
    _root.TWO._Y = shadowBox._Y-15;    

    _root.THREE._X = shadowBox._X+100;
    _root.THREE._Y = shadowBox._Y-15;            
}
OnLoad(){
    
    n=5;        
    ref = this.createEmptyMovieClip("ONE",n++);
    ref.createTextField("ONE",n++, 0,0,40,18);
    ref.ONE.text = this.ONE._name;
    ref.onRelease = function(){
        _root.nWidth = 300;
        _root.nHeight = 100;
      };
      
      
    ref = this.createEmptyMovieClip("TWO",n++);
    ref.createTextField("TWO",n++, 0,0,40,18);
    ref.TWO.text = this.TWO._name;
    ref.onRelease = function(){
        _root.nWidth = 150;
        _root.nHeight = 100;  ;
      };
      
            
                  
    ref = this.createEmptyMovieClip("THREE",n++);
    ref.createTextField("THREE",n++, 0,0,50,18);
    ref.THREE.text = this.THREE._name;
    ref.onRelease = function(){
        _root.nWidth = 400;
        _root.nHeight = 250;  ;
      }                                 
      
}
onFrame(1){stop();}

The Download

Download swish file






Discussion

Donna Robinson

Great script Joe :) thanks for putting this on swish-db

http://www.13dots.com

Ali

Indeed this is a great resource fo those who wish to learn more swishscript.

Dado

realy realy great script. thank you. is it posible to put a picture in whrn it´s resize ?? TIA

Joe Maddalone

of course - here`s a quick example I played with a while back. I abandoned it and its a bit messy.

Rahul

Yes Its nice script, i am searching for dynamic image gallary with image zoom any one can tell me the script for that

New comments are currently disabled, you can find me @joemaddalone Comments temporarily disabled for now, you can find me @joemaddalone