hi, i am working on a website where i want certain images to load whenever a user clicks on a thumbnail. I want a preloader to appear before the image is displayed. I created this so far:
mcLoader = new MovieClipLoader();
loadListener = new Object();
mcLoader.addListener(loadListener);
mcLoader.loadClip(“foto.jpeg”, placeholder_mc);
loadListener.onLoadProgress = function(placeholder_mc, loadedBytes, totalBytes) {
preloaded = Math.floor(loadedBytes/totalBytes*100);
loaderText_txt.text = preloaded+"%";
bar_mc._xscale = preloaded;
};
loadListener.onLoadComplete = function() {
loaderText_txt._visible = false;
bar_mc._visible = false;
};
This should work, right? When I preview this of course I see my image, but I want to know if the preloader works. So I hit ctrl+enter again and… nothing. The progress bar (bar_mc) blinks once and then blank… a white screen… Why is this??
Besides, I want this code to be executed when a user clicks a thumbnail, how can I implement this on a button, while at the same time, the first thumbnail should load automatically, so there’s no exmpty page when the user first opens the website?
Can someone please help me out here? Thanks!!