| skinnylizard 2004-03-11, 6:28 am |
| hi,
oh man. ive tried everything and every help fla and tutorial to get a
preloader to work right i.e. load jpegs. but the thing just wont work. ive
tried 3-4 different things but it is utterly useless and havent been able to
progress. lost valuable time too. its embarassing this.
ive tried flashkit and all the others but nothing of it.
used this
function loadPic(myThis, myPic) {
loadMovie(myPic, _root.bg);
myThis.onEnterFrame = function() {
percent = Math.floor((_root.bg.getBytesLoaded()/_root.bg.getBytesTotal())*100);
if (!isNan(percent)) {
_root.load_percent = ("loading background: "+percent)+"%";
} else {
_root.load_percent = "loading background: 0%";
}
if (percent == 100) {
_root.load_percent = "";
delete myThis.onEnterFrame;
}
};
bg_thumb.play();
}
_root.load_percent = "";
stop();
____________________________________________________
This on a button:
____________________________________________________
on (release) {
_root.loadPic(this, "bg1.jpg");
}
____________________________________________________
Don't forget to put a dynamic text box on the scene with load_percent variable
name and to make a movie clip named bg
Maybe the first code run well, but there was a file name probelm on my host
where I try them. You can try them both, but the second works 100%
AND
loader.autoLoad = false;
pBar.source = loader;
pBar.indeterminate = flase;
// Load image from URL Button
buttonListener = new Object();
buttonListener.click = function(){
loader.contentPath = _root.urlText.text;
loader.load();
}
this.loadURL.addEventListener("click", buttonListener);
// setup image url array for cycle button
// these are just images found from a google search
var ImageArray:Array = new Array();
ImageArray.push("http://www.qatargas.com.qa/media-room/images/high-res-2.jpg");
ImageArray.push("http://www.qatargas.com.qa/media-room/images/high-res-1.jpg");
ImageArray.push("http://www.qatargas.com.qa/media-room/images/high-res-3.jpg");
ImageArray.push("http://www.qatargas.com.qa/media-room/images/high-res-4.jpg");
ImageArray.push("http://www.qatargas.com.qa/media-room/images/high-res-7.jpg");
ImageArray.push("http://www.qatargas.com.qa/media-room/images/high-res-6.jpg");
ImageArray.push("http://www.qatargas.com.qa/media-room/images/high-res-5.jpg");
ImageCounter = 0; // var used to tick up an index in the array
buttonListener = new Object();
buttonListener.click = function(){
loader.contentPath = ImageArray[ImageCounter]; // tells the loader what url to
use from the ImageArray
loader.load(); // tells the loader to load the url
_root.loadImage.label = "Load Array Image "+ImageCounter; //(optional)
changes the text on the button
_root.urlText.text = ImageArray[ImageCounter]; //(optional) puts the array url
into the text field
// the following resets the ImageCounter to 0 if it is 6. If not it adds 1
if (ImageCounter == 6 ) {
ImageCounter = 0;
} else {
ImageCounter++;
}
}
_root.loadImage.addEventListener("click", buttonListener);
but nothing works. im losing my mind and soon my hair will fall. id appreciate
any help i can get.
thank you
xxx
Gaurav
|