This content has been marked as final. Show 6 replies
I gather you just want to load external images into a series of movieclips. You cannot just assign a path to a movieclip and have it load the image. Take a look at the MovieClipLoader class. Here is part of the example from the help files:
var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
The MovieClipLoader class will handle the loading for you.
Actually, I'd like to load a bunch of images into a loader component inside a movieClip. The movieClip also contains dynamic text fields as
Is it better to try to load the images an "image_mc" inside the movieClip instead of loading into loader component inside the movieClip?
think I got it.
this seemed to start working for me...
Sure, you can do that.
You created the container already and all of the movieclips that you wanted to hold the images, so just use that path in the MovieClipLoader's loadClip() function.
Couple of things to remember. If you only use 1 MovieClipLoader then you will have to wait for each clip to load before loading the next. If you want to load them at the same time, you could create a class around the MovieClipLoader, then pass the class instance the filename and have it perform the loading using the MovieClipLoader.
I did this for an image viewer with thumbnails. I have attached the code below. It is not the prettiest code but hopefully will give you an idea.
do you have this online? can I see it?
question. I've got the images loaded into a loader.... can I resize them to fit inside the loader? they are larger than the loader component is.
this code is complicated for my young flash mind to wrap around. though it appears to be what I'm trying to accomplish.
Yes, I do have it online but it is behind a corporate firewall so it is not viewable.
As far as resizing, you should be able to set the size to what ever you want. The code I posted will load the images at their full size, I then resize them once they have been fully loaded. Then the script also allows you to click on the image and it will then animate up to the full size of the image (or 400x400) which ever is smaller. The animation, is the Tween and uses the Tween fuction by Joey Lott (www.person13.com).
To get this to work you have to create 2 movieclips. The first is a container to which the code above is attached as a class. The second movieclip is placed inside the first and given the instance name "imageClip".
Then to load an image you would use:
mcContainer.LoadImage("path to image here");
where mcContainer is whatever the instance name of the first movieclip is.
In the code I set the sizes in the 2 objects thumbSize and regularSize. The regularSize is the 400x400 image and the thumbSize is the 50x50 image.
I will try to get this to a site that is not behind a firewall but I don't have a website so it may take a little time.