I have a file with one frame:
I have a set of simple, identical buttons. Each button tells
an empty movieclip to load a picture. The movieclip will scale the
picture appropriately and stay under a specified width and height,
and it will reposition appropriately.
I would like to put all the script on one frame.
I have bits of jumbled script that is supposed to do all
these individual things, but it won't work all together. I know how
to load a picture using loadMovie, but the movieclip isn't
retaining the size or position i told it to.
I don't know too much about actionscript, so any help would
be apprecitated. Thanks.
The problem with setting the size is that you have to do it
*after* the loading. Before, there's just an empty MC, and it's
size will always be 0, because it's empty. Plus, the loaded content
will set it to a new size. So the best way is to use the
MovieClipLoader class, which provides events that fire when the
loading finished. Create an instance of MovieClipLoader, and let
your buttons call the loadClip() method (not exactly sure if that's
the right name, see the Help).
Then define the onLoadInit event and place the resize code in
that. onLoadInit happens when the content is completely loaded and
initialized (if it is an MC with code in frame 1), and the right
place to change the properties. See the Help files for onLoadInit,
there should be an example. If you load the pictures this way, you
can easily resize when the loading finishs.