Share Posted February 25, 2011 Hi, I`m using ImageLoader class for image loading and processing. here is the code: var _qimage:ImageLoader = new ImageLoader(_image, {name:"photo1", estimatedBytes:2400, container:imageLoader, x:imageLoader.thBg.x, y:imageLoader.thBg.y, alpha:1, width:80, height:62, scaleMode:"proportionalOutside", onComplete:completeHandler, onError:errorHandler}); As you can see, by using: width:80, height:62 I define size in which image should be loaded and that needs to be loaded in that size, but I also need original size info. My question is: Can I get original/native size of Image I`m loading. Thank you Link to comment Share on other sites More sharing options...
Share Posted February 25, 2011 You can always get the native size of any DisplayObject using the getBounds() method, like this: var rawContent:DisplayObject = myImageLoader.rawContent; //gets the image that was loaded var bounds:Rectangle = rawContent.getBounds(rawContent); trace("native width: " + bounds.width + ", height: " + bounds.height); You could also access the rawContent's loaderInfo.width and loaderInfo.height. Link to comment Share on other sites More sharing options...
Share Posted November 4, 2011 Following on from this question I'm trying to use the full size loaded image elsewhere within my swf but I'm having difficulty accessing it. If we imagine the original size image is 1024x768 and the ImageLoader has displayed the image at 100x75. So I have to following example which traces out the correct full size dimensions: var rawContent:DisplayObject = myImageLoader.rawContent; //gets the image that was loaded var bounds:Rectangle = rawContent.getBounds(rawContent); trace("native width: " + bounds.width + ", height: " + bounds.height); Doing this removes the smaller image and places it onto my container MC. container.addChild(myImageLoader.rawContent); How can I create a full sized version of the loaded image to place onto my container MC as well as leaving the smaller version where it is? Thanks for any help you can give me. Mark I think I found the solution unless there is a more efficient way? var bm = new Bitmap(myImageLoader.rawContent.bitmapData, "auto", true); Link to comment Share on other sites More sharing options...
Share Posted November 7, 2011 I think I found the solution unless there is a more efficient way?var bm = new Bitmap(myImageLoader.rawContent.bitmapData, "auto", true); Bingo. You've got it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now