By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,854 Members | 833 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,854 IT Pros & Developers. It's quick & easy.

How to Change image size at runtime in flash

P: 2
I am developing photo gallery in Macromedia Flash 8 and XML to retrive the Image. Image Size is all in different size. my question is How to Change image size at runtime in flash? so that image display one by one automatically with correct resized image please help thanks in advances
Feb 27 '08 #1
Share this Question
Share on Google+
7 Replies


nomad
Expert 100+
P: 664
I am developing photo gallery in Macromedia Flash 8 and XML to retrive the Image. Image Size is all in different size. my question is How to Change image size at runtime in flash? so that image display one by one automatically with correct resized image please help thanks in advances

Just a word of advice:
Always bring your images into Flash at the actual size (pixel dimensions) you intend to use them at. Anytime you scale an image on the Flash Stage, it will be resampled and interpolated. Photoshop if you have it does a much better job than Flash when it comes to resampling. The only exception to this rule is when you are animating the scale of an image. Of course, in that scenario, it is always best to bring the image in from Photoshop at its largest size in the desired animation.

nomad
Feb 27 '08 #2

Rabboni
P: 3
to change the image size

first u convert that images into movieclip and then set the height and width of that movieclip
at runtime
Feb 29 '08 #3

P: 2
to change the image size

first u convert that images into movieclip and then set the height and width of that movieclip
at runtime

Thanks Robboni
thats my question how to resize at runtime? i dont know the logic of that one
Mar 20 '08 #4

P: 1
if(canvas._width/canvas._height>target_mc._width/target_mc._height)

i stole this code from "photoreel.fla" i can remember where in the Web it is





here is the full code for the image resize

if(canvas._width/canvas._height>target_mc._width/target_mc._height)
{
//set the image height to the canvas' height
target_mc._height=canvas._height;
//scale the width according to the height, to fit into the canvas dimensions
target_mc._xscale=target_mc._yscale;
//move the image to the center of the canvas
target_mc._x=(canvas._width-target_mc._width)/2;
}else{
//canvas is higher or equal to the proportions of the image
//set the width to the canvas' width
target_mc._width=canvas._width;
//fit the height into the canvas
target_mc._yscale=target_mc._xscale;
//move the image into the center vertically
target_mc._y=(canvas._height-target_mc._height)/2;
}
Jun 25 '08 #5

P: 2
My problem is different. I have the fixed size movie clip and images are of different size. I want the image to be auto fix in that movie clip size. Support my movie clip is 200x200 and the image is 300x300, then I want this image to be completely visible but in 200x200 only. Currently the image is getting cut and cant see the complete image if its large. Please help
Oct 26 '08 #6

joedeene
100+
P: 583
My problem is different. I have the fixed size movie clip and images are of different size. I want the image to be auto fix in that movie clip size. Support my movie clip is 200x200 and the image is 300x300, then I want this image to be completely visible but in 200x200 only. Currently the image is getting cut and cant see the complete image if its large. Please help
The only way a flash file size(the whole thing) is if you change the size under the properties, so why not edit the image size while editing the flash file size at the same time, to see what it looks like before publishing. And I don't think you can resize just plain bitmaps(images). I think it needs to be converted to a MovieClip

joedeene
Oct 26 '08 #7

P: 2
The only way a flash file size(the whole thing) is if you change the size under the properties, so why not edit the image size while editing the flash file size at the same time, to see what it looks like before publishing. And I don't think you can resize just plain bitmaps(images). I think it needs to be converted to a MovieClip

joedeene
Thanks joedeene. But I have been googling the whole day and got frustrated with the fact that everybody is talking on forums about resizing the MovieClip and that is what I am able to do. But nobody is talking about -- "Making the image itself to fit in the moviw clip". I have tried all possible combinations (like resizing he loader.content, creating BitmapData and resizing it etc). I am able to resize the movie clip but not the image to fit completely with in the movie clip size.
I am sure this may be too trivial but being a newbie in flash/AS3, its looks impossible to be at this point and I urgently need it to finish my college project. Any sample code will be great!

TIA
Oct 27 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.