I have a number of pics(around 30) and of large size(~5kb). Now i have made a simple xml file to load this images into the game and display them all at once…but the pics are not being loaded. I mean, in the editor itself, it loads most of them, except 4-5 heavy ones. but on my server only 4 pics of 2 kb are being loaded and rest are skipped. In the frame before this frame, i have a button, to come to this frame, and on coming to this frame, the user is supposed to see all the pictures in a grid. How can i make sure all the pics are loaded, and then show this page?
If your’e using AS2, search for “MovieClipLoader” in the help files. I would use a variable for a counter and increment it every time the onLoadInit(an event dispatched when MovieClipLoader finishes loading an image) is fired and check if the counter value is == xml nodes length. If it is, then you could proceed.
If you’re using AS3, look for Loader() and URLRequest.
The approach is similiar. add and event listener, say like addEventListener(Event.COMPLETE, imageLoaded) and in the function imageLoaded increment the counter.
My 2 cents. Probably a better way exists.
bLaf, all the nodes information is already being read in, but for some particular reason, the heavy images are not being loaded
Well, that’s why you better use MovieClipLoader(if you don’t already) and define a function for when onLoadInit is dispatched. That guarantees the image is loaded(i.e. this event is dispatched when the image is fully loaded and ready to be displayed).
a short improvisation:
var XMLIndex:Number = 0;
var ArrayOfMCs:Array = new Array(mc1, mc2, mc3, mc4, another_mc);
var listener_object:Object = new Object();
var MovieClipLoaderInstance:MovieClipLoader = new MovieClipLoader();
MovieClipLoaderInstance.addListener(listener_object);
listener_object.onLoadInit = function(target_mc) {
trace("the image is fully loaded in movie clip " + target_mc);
trace("proceeding to next image: ");
XMLIndex++;
MovieClipLoaderInstance.loadClip(XMLFile.firstChild.childNodes[XMLIndex].attributes["path_to_image"], ArrayOfMCs[XMLIndex]);
}
MovieClipLoaderInstance.loadClip(XMLFile.firstChild.childNodes[XMLIndex].attributes["path_to_image"], ArrayOfMCs[XMLIndex]);
And yes in case we’re talking about different things you could post/attach your code/fla and I’ll try to help.