brunoperry

resize DisplayObject

Oct 26th, 2011
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function resize( mc:Object, w:Number, h:Number = 0, cp:Boolean = true ):void
  2. {
  3.     h = h == 0 ? w: h;
  4.     w = w == 0 ? h: w;
  5.            
  6.     mc.width = w;
  7.     mc.height = h;
  8.  
  9.     if( cp )
  10.     {
  11.         mc.scaleX < mc.scaleY ? mc.scaleY = mc.scaleX : mc.scaleX = mc.scaleY;
  12.     }
  13. }
  14.  
  15. /**
  16.  * EXAMPLE:
  17.  *
  18.  * var fxg:FXGART = new FXGART();
  19.  * addChild( fxg );
  20.  * resize( fxg, 200 );
  21.  *
  22.  */
Advertisement
Add Comment
Please, Sign In to add comment