I am attempting to use a preloader with an Array of images. The original preloader (which appears to work, and was acquired from elsewhere on the forums) is. Most importantly, I am able to get the _width of the jpg once it is loaded:
// create empty preloader
this.createEmptyMovieClip(“preloader”, 1000);
this.createEmptyMovieClip(“container”, 1001);
container.loadMovie(“pic1.jpg”);
container._visible = false;
preloader.onEnterFrame = function() {
var l = container.getBytesLoaded();
var t = container.getBytesTotal();
var getPercent = l/t;
if (l>0 && l>=t) {
container._visible = 1;
delete this.onEnterFrame;
}
};
My ‘hacked’ version using an array from a file named ‘pictures.txt’ is:
loadPictures = new LoadVars();
loadPictures.load(“pictures.txt”);
loadPictures.onLoad = function (success) {
if (success) {
picArray = new Array();
picArray = loadPictures.pics.split(’,’);
for (loopCount =0; loopCount < picArray.length ; loopCount++) {
// create empty preloader
_root.createEmptyMovieClip(“preloader” + loopCount, loopCount);
_root.createEmptyMovieClip(“container” + loopCount, loopCount);
_root[“container”+loopCount].loadMovie(picArray[loopCount]);
_root[“container”+loopCount]._visible = false;
_root[“preloader”+loopCount].onEnterFrame = function() {
var l = _root["container"+loopCount].getBytesLoaded();
var t = _root["container"+loopCount].getBytesTotal();
var getPercent = l/t;
if (l>0 && l>=t) {
_root["container"+loopCount]._visible = 1;
delete _root["preloader"+loopCount].onEnterFrame;
}
};
// end preloader
}
} else {
trace("Not loaded");
}
}
This loads the images, but I’m unable to get the _width from the loaded Images. It doesn’t seem to ever enter the:
_root[“preloader”+loopCount].onEnterFrame = function() {
section (I put in a trace() and it was never returned). Is there a way I can use ‘this.xxxx’ if I’m using dynamically generated names? I attempted using eval() but it doesn’t work fro the this.onEnterFrame = function() { line because it messes up the syntax.
Hopefully I am making SOME sense. I’ve only been working with flash for a couple of days now. The reason I need to load a series of images, is I want to create transitions between the images.