Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Movie Clip Dimensions once loaded using loadmovie...

Posted on 2004-08-18
10
Medium Priority
?
1,601 Views
Last Modified: 2009-07-29
I am loading .jpg images into a target MC using the loadMovie function in Flash MX 2004 pro.  Once the .jpg is loaded, the movieclip is still showing a width and height of 0.  How do I get the target movie clip to "inherit" the dimensions of the .jpg image dynamically?  I have done this before, but I have not developed in Flash for about 6 months and I lost some of the touch...  I need the dimension so that I can dynamically position the images in the Flash movie...

Thanks in advance.
0
Comment
Question by:acekz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 7

Expert Comment

by:fixitben
ID: 11831139
Place the center point of the MC in the top left hand corner of your screen and Then add this to the first frame of the MC

_x = 0;
_y = 0;
_width = 100;
_height = 100;

And that will resize it for you

here  is a link to one that is what is above
http://theyac.org/resize.fla
fixitben
0
 

Author Comment

by:acekz
ID: 11831390
Maybe I was not clear in problem.  I don't want to give it a particular size.  I have a movie clip on stage that I am loading a .jpg image into.  I want the movieclip on stage to inherit the dimensions of the .jpg that is being loaded, but as it stands right now the MC on stage is keeping its original dimensions instead of conforming to the dimensions of the .jpg image being loaded.
0
 
LVL 7

Expert Comment

by:fixitben
ID: 11831954
If you load them into just a empty MC then they will resize automatically with no code  here is a file showing you that.  

http://theyac.org/resize.zip

fixitben
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:Zeffer
ID: 11836680
the target clip does inherit the dimensions of the loaded image.

to demonstrate this..with a target clip named..Target
and assuming the clip is on the main timeline

if you put a button on the stage with the following code ..

on(rollOver){
      trace(getProperty(_root.Target,  _width));
       trace(getProperty(_root.Target, _height));
}

rollover the button before you load an image and then after an image has loaded .. and you will see the values change

Z
0
 

Author Comment

by:acekz
ID: 11840736
Ok...so I loaded the .jpg into the movie clip on stage when the frame loaded.  However, if there is a stop() command on that frame the MC still retains its original dimension.  However, if I load the image into the MC and then let the timeline run 2 frames down and then check the dimensions, the MC now has the dimensions of the .jpg image that was loaded.  Is that weird/quirky or am I missing something.  I have used all the tips in this question and that is what I get.

Thanks.
0
 
LVL 7

Expert Comment

by:fixitben
ID: 11841944
set the emptyMC properites hight and width to  0 x 0  That should fix it.

Fixitben
0
 
LVL 23

Accepted Solution

by:
Zeffer earned 1000 total points
ID: 11866460
I suspect that will not fix it .. ben :)
acekz .. can you post a simple example of the problem .. then we can see the code you are using ..
i'm unable to re-create what you describe .. stops and all

Z
0
 
LVL 7

Expert Comment

by:fixitben
ID: 11866504
yeah I figured that out later but forgot to reply. I was in a hurry and wasn't thinking right.

fixitben
0
 

Author Comment

by:acekz
ID: 11915923
Ok I got it to work, but none of the suggestions here did it. sorry.  The empty movie clip only inherited the properties of the loaded .jpg image after the pay head moved down 2 more frames...very weird, but I am making it work...thanks...if anyone has a reason for this I would still like to know...

Thanks!
0
 
LVL 7

Assisted Solution

by:fixitben
fixitben earned 1000 total points
ID: 11990689
Well at this point Award the points or ask for a refund.  

Fixitben
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question