Solved

Movie Clip Dimensions once loaded using loadmovie...

Posted on 2004-08-18
10
1,593 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Youtube video error 30 810
Failed download 57 570
Flash player updates using SCCM 2012 and SCUP 2011 3 443
Adobe flash player memory exhaustion 6 96
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

832 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