Solved

Movie Clip Dimensions once loaded using loadmovie...

Posted on 2004-08-18
10
1,587 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 7

Expert Comment

by:fixitben
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Well at this point Award the points or ask for a refund.  

Fixitben
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
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 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.

772 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

11 Experts available now in Live!

Get 1:1 Help Now