Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-05-2004, 10:23 AM   #1
divarch
Not a teenager
 
divarch's Avatar
 
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
Send a message via MSN to divarch Send a message via Yahoo to divarch
Default 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.
divarch is offline   Reply With Quote
Old 02-05-2004, 10:39 AM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

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... )
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 02-05-2004, 12:06 PM   #3
divarch
Not a teenager
 
divarch's Avatar
 
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
Send a message via MSN to divarch Send a message via Yahoo to divarch
Default

Hehe, coffee..

No, I want to set the size of the container based on the size of image loaded.

Thanks for trying to help
divarch is offline   Reply With Quote
Old 02-05-2004, 12:24 PM   #4
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

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...
Attached Files
File Type: zip divarch.zip (23.4 KB, 299 views)
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 02-05-2004, 12:40 PM   #5
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

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.
__________________
(6)
senocular is offline   Reply With Quote
Old 02-05-2004, 04:50 PM   #6
divarch
Not a teenager
 
divarch's Avatar
 
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
Send a message via MSN to divarch Send a message via Yahoo to divarch
Default

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
divarch is offline   Reply With Quote
Old 02-05-2004, 04:51 PM   #7
divarch
Not a teenager
 
divarch's Avatar
 
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
Send a message via MSN to divarch Send a message via Yahoo to divarch
Default

Where's the file?? A, here it is...
Attached Files
File Type: zip preload.zip (87.9 KB, 323 views)
divarch is offline   Reply With Quote
Old 02-05-2004, 06:46 PM   #8
gaza
Registered User
 
Join Date: Mar 2003
Posts: 99
Default

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.
gaza is offline   Reply With Quote
Old 02-05-2004, 07:01 PM   #9
divarch
Not a teenager
 
divarch's Avatar
 
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
Send a message via MSN to divarch Send a message via Yahoo to divarch
Default

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.
divarch is offline   Reply With Quote
Old 02-05-2004, 07:29 PM   #10
gaza
Registered User
 
Join Date: Mar 2003
Posts: 99
Default

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;
gaza is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:48 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.