473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How to Change image size at runtime in flash

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
7 19265
nomad
664 Expert 512MB
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
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
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
rupihj
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
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
583 512MB
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
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

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

Similar topics

7
by: Haines Brown | last post by:
I'm in the practice of specifying img width and height in my style definitions, although I usually use the actual size of the image. I'm reworking the style and it would be convenient to leave...
0
by: EarthlingZ | last post by:
Anyone with any good ide or simpel script? How to chance size on a pic that is uploaded? I would be happy if its pretty easy so I understand what kind of code I am using :$
2
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error...
11
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the...
0
by: Gavin | last post by:
Can anybody give me a code example of how to change an image size and resolution. I can upload a image file to a PostedFile. But what I need to do is change the size of that image and save it to my...
2
by: miladhatam | last post by:
i've made a dynamic website that upload an image file in image directory with fileuploader control and it's name was renamed and get ready to show with image control but i have a problem i want...
8
by: miladhatam | last post by:
can i change the size of a file dynamically ? for example have 100 Kb and i want to decrease it to 20 Kb thanks
5
by: johnric | last post by:
I can't seem to get firefox to read the image size in my javascript. It will work in IE and firefox but firefox will not read the image size. Can anyone see the problem in my code? I am new to...
2
by: Tark Siala | last post by:
hi i'm wprking with C# 2005 + SP1, and i want load image from image file, and then resize it (like from 800X600 Pixel to 640X480 Pixel), and then save it in another image file, i want do that for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.