Click to See Complete Forum and Search --> : dynamic image loads


michaellunsford
09-09-2008, 11:03 PM
Okay, so I've found about a billion different tutorials claiming they're the easiest way to do this. After hacking on this all stinking day, I've finally given up and hope someone here can help.

Some of these online tutorials are simple and work when they want to (and are not listenable), and some are crazy stupid complex. The only problem with the crazy stupid complex ones is they only load one image. If I can't figure out what the devil they're doing, how can I load four more? Yeah, not going to happen.

So why am I telling you all this? So somebody doesn't say "just google it" -- now you know I did and I'm more frustrated than ever.

Okay, so on to the problem:
I need to load five images from five URLs. Each image is in a single slide in a movie. The movie is all setup, the five slides are all setup, I just can't get the images to load inside the slides.

The URLs are coming in through a super-simple loadvars function with a listener. Once the URLs are loaded, a function fires to load the images.

I've tried the built in Loader component. It works great on a single layer flash "test" file, but when I pop it into my multi-layer flash file (where the images are tucked inside a movie instance), it just doesn't work. trace(this) tells me the name of the instance (see code below). I make the contentPath load to there and get squat.


lv = new LoadVars();
lv.load("http://example.com/get_data.php");
lv.onLoad = function() {
load_some_images();
}
load_some_images = function() {
_layer0.instance23.image1.contentPath = lv.PhotoURL1;
}


Truth be told, I'd prefer one that has a listener attached so I can launch the movie AFTER the images have loaded. Also, one that works would be better too ;-)

Due to some "features" (ala Microsoft) in the new CS3, I am hoping to write this in AS2 and compile in Flash 8. Any help would be super greatly appreciated.

michaellunsford
09-10-2008, 12:13 AM
okay, so here's the one from the flash documentation. Aside from the questions I have //commented into the code, I really really need to figure out how to load multiple images and size them correctly. Is it just a matter of using the mcLoader.loadClip and targeting to a different movie name, or is it more complicated than that?

Oh, and see the code below. The other major issue I have is not being able to put the image where I want it :confused:


lv = new LoadVars();
lv.load("http://example.com/get_data.php");
lv.onLoad = function() {
load_some_images();
}
var container:MovieClip = createEmptyMovieClip("container",getNextHighestDepth()); //okay, I get what this is doing, but I already have a movie I want to stick this image into. it's called "image1" but if I disregard this and put "image1" in the loadClip area, I get squat. Not to mention, this just plops the image right on top of everything.
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
load_some_images = function() {
mcLoader.loadClip(lv.PhotoURL1, container); //the magic that makes it load. Again with the new movie clip. I have a movie clip already. How do I point it to my movie clip name (image1)?
}
function onLoadInit(mc:MovieClip) {
trace("onLoadInit: " + mc);
mc.width=180; //okay so I added this to resize the image. It doesn't work.
mc.height=120; //this also doesn't work.
}

Eye for Video
09-11-2008, 02:36 AM
Sorry about your difficulties but have you tried to load the images via an .xml file? It’s pretty easy, simple, and staightforward.
Are you saying that each image is in a frame in the timeline or what? Do not want them all to load at the same time or only when they are reached in the timeline? Will these images be always changing or are they set? Resizing will always
add another level of complexity.
In my humble opinion, using vars is the last way to go. If you have Flash, code in the AS to either loadMovie direct or use xml
EfV

michaellunsford
09-15-2008, 02:17 PM
finally figured it out, I had neglected to name the primary container. Took a few days, but I finally stumbled upon it with help from a friend.


Thanks for replying, though.