Jump to content
Search Community

imageLoader noScaleUp condition?

JE.T test
Moderator Tag

Recommended Posts

Hi,

 

I working on loading a bunch of different images and i want my loader to be in a maximum display size but not to scale up if the image is smaller, So no problem there for scaling down the images with this for exemple :

 

var loader:ImageLoader = new ImageLoader("images/"+_img, {name:"photo"+_img, container:pictureContainer, width:550, height:600, scaleMode:"proportionalInside", centerRegistration:false, onComplete:pastePicture});

//begin loading
loader.load();

private function pastePicture(e:LoaderEvent):void {
e.target.content.graphics.clear() ;
}

 

Could i had something to make sure the images will not be scaled more then there original width or height ?

 

Thank for advices and help,

JeT

Link to comment
Share on other sites

I suppose you could not set a width/height, wait for it to init, and then apply your logic kinda like:

 

var loader:ImageLoader = new ImageLoader("images/"+_img, {name:"photo"+_img, container:pictureContainer, centerRegistration:false, onInit:resizeImage});

loader.load();

function resizeImage(event:LoaderEvent):void {
   var cd:ContentDisplay = event.target.content;
   if (cd.width         cd.fitWidth = 550;
       cd.fitHeight = 600;
       cd.scaleMode = "proportionalInside";
   }
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...