02-05-2004, 10:23 AM
|
#1
|
|
Not a teenager
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
|
Retaining original .jpg size with loadMovie()
Hi guys, I have done a search throughout a forum, but was unable to find an answer (also checked out CB's useful thread but no go), so:
How can I make loaded .jpg retains it's original size, regardless of container that loads it.
So far, when I load it up, container stretches(or resamples) the loaded content to fit it's own size.
The reason I need this, is I want to container dynamically resize( scaling with ease), and without it it cannot be done.
Thanks for any help.
|
|
|
02-05-2004, 10:39 AM
|
#2
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
Howdy...
I don't get your question... 
So, you want to load the JPEG into the Flash and you want the size of the JPEG file maintained when it is loaded into the Flash or you want to maintain the size of the movieclip that you are trying to load the JPEG file into???
(Yeah... I know... I need more coffee...  )
|
|
|
02-05-2004, 12:06 PM
|
#3
|
|
Not a teenager
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
|
Hehe, coffee..
No, I want to set the size of the container based on the size of image loaded.
Thanks for trying to help
|
|
|
02-05-2004, 12:24 PM
|
#4
|
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
|
Um... It turns out to be that it is not the coffee problem...
You just made me to test it though...
The first one... The holder movieClip is 450 x 300 and I am loading 400 x 262 JPEG file and Flash is loading without stretching...
The second one... The holder is 300 x 200, and Flash is stretching the JPEG file as it should be...
The third one... The empty movieclip holder... Same thing as the second one...
Now, I AM confused...
|
|
|
02-05-2004, 12:40 PM
|
#5
|
|
six eyes
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
|
There should be no "stretching".
Loaded jpegs are not changed when they are loaded. They come in at the size they actually are. When they are placed in a movieclip, that movieclip's _width and _height may change based on this new content, but that new content (the image) has not changed in size iself.
For example, an empty clip has a height and width of 0. Why? Because its empty. Loading an image into that clip will then change the content of that clip making its extents stretch beyond 0,0 out to the size of the clip (a movieclip's size is based on the content within it).
If your movieclip already has content, say, another image, then that content will be removed when a new image is loaded (changing its original height and width to 0). Then, once the loading of the new clip is complete, the size of the clip will reflect its current content... or the image within it, whatever size that image may be.
The only time a loaded image will not be its actual size is if its being effected by any scale modifiers by any of the movieclips in its _parent heiarchy (including the clip it was loaded into). So if a movieclip is loaded into _root.box.can, if box or can has any _xscale or _yscale properties other than 100, the image will not be shown at original size.
... Im not sure how this all applies to what you're working on, but maybe this will bring some things to light.
|
|
|
02-05-2004, 04:50 PM
|
#6
|
|
Not a teenager
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
|
First thanks guys for excellent feedback, I got answers all right.
Senocular, I am loading images in a author-made container without affecting it's x(y)scale props through AS.
I have been working on this in terms of practice, so to speak, in preparing what I will use in creating my own portfolio which will have img gallery among other things.
The problem was that, once image loads it should retain it's size, because I already resampled them in another app.
CB, your post and examples very much explain itself, and I thank you very much on that.
I will attach an example of what I did,(ignore the preloader)
So, if I change container's size manually, not through AS, image loaded is resized to fit, (enlarged or shrank). That is what bothers me.
I will try with 'empty clips', I only did it this way, to visually position my images.
Another thing is, is there a way I could refer to them after the loading part (I know container's gone after loading) so can I do some functions on it, like scaling or positioning runtime.
Thanks again on your feedback, and sorry I am late with response, I was out.
Cheers
|
|
|
02-05-2004, 04:51 PM
|
#7
|
|
Not a teenager
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
|
Where's the file?? A, here it is...
|
|
|
02-05-2004, 06:46 PM
|
#8
|
|
Registered User
Join Date: Mar 2003
Posts: 99
|
Hi, divarch,
Looking at your file you have scaled container_mc and as senocular this is going to effect you image your loading.
So by creating a empty mc first would eliminate this problem which is what senocluar also said.
If you are wanting to set the a property based on the container_mc, setting the prop as a var before you load your image enables you to call it and set the loaded image prop to the old container_mc prop.
|
|
|
02-05-2004, 07:01 PM
|
#9
|
|
Not a teenager
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
|
Yes, I understood what Senocular told me, I've created a new container, without any scaling and now it works, with images untouched.
For the second part, I am not quite sure how to call some event handlers on the container, once image is finished loading.
Like an 'onEnterFrame' event for example, just to move it around a bit, for a start.
Thanks for your input
edit Yeap, the coords settings after loading wouldn't work, but since I created a new container without manual rescaling, now it does work.
I will go now experimenting with some more serious movement, in the meantime, thanks everyone again for their efforts
Last edited by divarch; 02-05-2004 at 07:04 PM.
|
|
|
02-05-2004, 07:29 PM
|
#10
|
|
Registered User
Join Date: Mar 2003
Posts: 99
|
In reply to the second part, just call the new container mc that you load you image into just as you would any other event, just make sure its 100% loaded before calling the event eg new_container._width > 0;
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 10:20 PM.
///
|
|