Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resize image

Status
Not open for further replies.

iluvperl

Programmer
Jan 22, 2006
107
I am not familiar with flash, so I need a simple copy/paste solution.

I have an image viewer that loads an image from a directory, but it turns out I was told it's NOT possible to resize the flash scene dynamically and it has to be coded in the swf.

Since this isn't possible, I need to resize every image down to fit the screne. I assume Flash can do this but I only want it to resize down if it's too large, otherwise keep it how it is.

Now the issue I see with this is, for small images they'll load WHERE in the scene? In the center? That wouldn't be so bad.

Can anyone give me a hand here?

This is my entire swf file which takes a URL as a param.

_root.createEmptyMovieClip("holder",0);
_root.holder.loadMovie(pic);
 
Thing is you won't know the picture's dimensions until it's fully loaded in the container clip...

This would be the pseudo code...

Create the container clip.
Set it's alpha to 0.
Load the picture.
Get the dimensions... As soon as the container clip's width is larger than 0, then you can read the dimensions...
If they're larger than your maximum acceptable size, scale down the container clip.
Position the container clip.
Set it's alpha to 100.

Repeat the process for every loaded in picture.

Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
After looking more closely, the problem is the image is being resized automatically.

I see there is a PROPERTIES tab in Flash that was originally 450x500 or something, I think. So in the HTMl, I was using a h/w that was much larger. What happened was the image was resized IN flash to be BIGGER and thus it didn't fit. It looks like the physical flash window is the right size but it resizes my image so that it's actually bigger than the original.

I then thought I could set the PROPERTIES flash height and width to a large 1600x1600 and try again. The exact same results happened.

I was told JS can dynamically change the size of Flash. But if JS can do it, can't the params be passed via HTML? And why is my image resizing when all I am doing is loading it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top