Basic proportional resize

7 1 30th 2007 § 0 comments

One of those little things I hate to remember.

// define the vars
var desiredSize:Number ;
var currentSize:Number ;

// check to see which side is longer
if( sizeRef.width > sizeRef.height )
{
     desiredSize = sizeRef.width;
     currentSize = sizeMe.width;
} else {
     desiredSize = sizeRef.height;
     currentSize = sizeMe.height;
}

//Get the %
var scale:Number = (desiredSize / currentSize) * 100;

//Set the _xscale and _yscale of the loaded image
sizeMe.scaleX = sizeMe.scaleY = scale;

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What's this?

You are currently reading Basic proportional resize at DrPunchBlog.

meta

  •  

    July 2007
    M T W T F S S
    « May   Aug »
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031  
  • Archives

  • The Uber-Mannerist ...
    By Van Arno
  • RSS mtr.me

    • ‘Up In The Air’ Producer Launches The Allegiance Shingle With IM Global-Funded ‘Money Monster’
      EXCLUSIVE: Daniel Dubiecki has launched The Allegiance Theater, a association designed to emanate a breakwater where talent and financiers can induce film and TV projects. The association gets off a belligerent with a privately-backed beyond and growth account to beget character-driven, commercially appealing stories, pronounced Dubiecki. As Jason Reitman’s […]
    • New Oils
      James and Esao both published oil paintings to their blogs recently, James’s work on tip is titled, “Pauline Prieto“, and Esao’s investigate underneath it is substantially eleven or thirteen years aged now from art propagandize and he writes about because it is called “Grumpy Study”. Article source: http://meathaus.com/2012/02/06/new-oils/ […]
    • Video Game Character Facebook Profiles
      This is a array of cinema from a Facebook profiles of video diversion characters. Obviously they’re fake, that we wish we would’ve famous before spending a half hour perplexing to find and crony Nathan Drake and Solid Snake. OMG, how cold would it be to know those dual guys in genuine life? “Wow,GW — man-crush […]
  • Translator