Solved

Movie Clip Dimensions once loaded using loadmovie...

Posted on 2004-08-18
10
1,589 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
  • 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 250 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 250 total points
ID: 11990689
Well at this point Award the points or ask for a refund.  

Fixitben
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

929 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now