[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1604
  • Last Modified:

Movie Clip Dimensions once loaded using loadmovie...

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
acekz
Asked:
acekz
  • 5
  • 3
  • 2
2 Solutions
 
fixitbenCommented:
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
 
acekzAuthor Commented:
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
 
fixitbenCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ZefferCommented:
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
 
acekzAuthor Commented:
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
 
fixitbenCommented:
set the emptyMC properites hight and width to  0 x 0  That should fix it.

Fixitben
0
 
ZefferCommented:
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
 
fixitbenCommented:
yeah I figured that out later but forgot to reply. I was in a hurry and wasn't thinking right.

fixitben
0
 
acekzAuthor Commented:
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
 
fixitbenCommented:
Well at this point Award the points or ask for a refund.  

Fixitben
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now