PDA

View Full Version : LoadClip failing without Listener sending loadError???


JoeMoney
09-09-2005, 03:32 PM
Wow, so still having a random problem with JPEGs not initializing after my ClipLoader calls loadClip and adds a listener. No loadError, just not loading all the clips. This is a huge problem for this project as I am waiting for all JPEGs to load before I space them out on a grid. if one fails to load, my project site idle displaying my number of jpegs to load message.

Aaaaaaaaarrrrrgh. If this isn't fixed the boss is going to make me go to some crappy .net solution with no animation. Pleeeease help.

Joe$

Navarone
09-09-2005, 08:51 PM
How did format the jpg images? If you saved them as progressive, they will never load, that being said, can you post your code? 'can't really help you otherwise. :)

JoeMoney
09-12-2005, 03:56 PM
Sorry it is a little bloated. I am sure I will want to rewrite this as I get better with object orientation. The jpegs are not progressive, and the loading problem is not consistent. so I am stumped. It seems to me that I might want to do a set interval at like 10 seconds and if the jpeg hasn't finished loading, just reload it, but then I get into a recursion swamp of calling and calling and calling if the user has a slow connection...

Anyway here we go.
//************ OBJECTS & MCLoaders ************
// -----=-=-=-=-=-=-=-=-=-=-==-=-=-
var xmlImages = new XML();
var theLoader = new MovieClipLoader();
var theListener = new Object();
var theLoadAdder = new Object();
// ______ LISTENER METHODS
theListener.onLoadError = function() {
trace("onLoadError");
};
theListener.onLoadInit = function() {
theLoadAdder.addItUp();
};
// ______ LOADADDER METHODS
theLoadAdder.spacemOut = function() {
total = bucket.length;
lastY = 0;
bumpHolder = xmlImages.firstChild.childNodes[1].firstChild;
bumper = parseInt(bumpHolder);
tempX = bumper;
tempY = bumper;
counter = 0;
NumOrows = Math.round(Math.sqrt(_root.total));
NumPerRow = Math.ceil(Math.sqrt(_root.total));
trace("NumOrows = "+NumOrows+" NumPerRow = "+NumPerRow);
maxHeight = 0;
maxSize = 0;
for (i=0; i<=total; i++) {
temp = "mcHolder"+i;
mcImage[temp].createTextField(i, i+100, mcImage[temp]._x, (mcImage[temp]._y+mcImage[temp]._height), mcImage[temp]._width, 150);
mcImage[temp][i].autoSize = true;
mcImage[temp][i].wordWrap = true;
mcImage[temp][i].text = String(bucket[i][2]);
mcImage[temp][i]._width = mcImage[temp]._width;
tempMax = mcImage[temp]._height;
if (tempMax>maxSize) {
maxSize = tempMax;
}
tempMax = mcImage[temp]._width;
if (tempMax>maxSize) {
maxSize = tempMax;
}
}
for (i=0; i<total; i++) {
counter++;
temp = "mcHolder"+i;
if (counter>NumPerRow) {
trace("_______NEW ROW_________");
tempY = tempY+maxSize+bumper;
tempX = bumper;
counter = 1;
}
mcImage[temp]._x = tempX+((maxSize-mcImage[temp]._width)/2);
mcImage[temp]._y = tempY+((maxSize-mcImage[temp]._height)/2);
invisoName="invisoMC"+i;
mcImage.attachMovie("invisoMC",invisoName,i+2000);
mcImage[invisoName]._x=(tempX+((maxSize-mcImage[temp]._width)/2)-5);
mcImage[invisoName]._y=(tempY+((maxSize-mcImage[temp]._height)/2)-5);
mcImage[invisoName]._width=mcImage[temp]._width+10;
mcImage[invisoName]._height=mcImage[temp]._height+10;
tempX = tempX+maxSize+bumper;
mcImage[temp]._alpha = 100;
}
stageWidth = Stage.width;
//trace(Stage.width);
stageHeight = Stage.height;
//trace(Stage.height);
maskWidth = Stage.width-(4*bumper);
maskHeight = Stage.height-(4*bumper);
this.createEmptyMovieClip("maskerMC", 1000);
maskerMC.lineStyle(0, 0xF9150D, 100);
maskerMC.beginFill(0xDEDEDE);
maskerMC.lineTo(maskWidth, 0);
maskerMC.lineTo(maskWidth, maskHeight);
maskerMC.lineTo(0, maskHeight);
maskerMC.lineTo(0, 0);
maskerMC.endFill();
maskerMC._x = (stageWidth-maskWidth)/2;
maskerMC._y = (stageHeight-maskHeight)/2;
mcImage._x = maskerMC._x;
mcImage._y = maskerMC._y+(2*bumper);
mcImage.setMask(maskerMC);
maskerMC.duplicateMovieClip("maskerMC2",-10000);
nextX=mcImage._x;
nextY=mcImage._y;
};
theLoadAdder.addItUp = function() {
total = bucket.length;
tempInt2++;
loadedText.text = "Loading image #"+tempInt2+" of "+total;
if (tempInt2>=total) {
theLoadAdder.spacemOut();
loadedText.removeTextField();
activation=1;
}
};
theLoadAdder.loademUp = function() {
for (i=0; i<bucket.length; i++) {
tDepth = i+10;
temp = "mcHolder"+i;
path = "_root.mcImage.mcHolder"+i;
loaderURL = String(bucket[i][0]);
mcImage.createEmptyMovieClip(temp, tDepth);
theLoader.loadClip(loaderURL, mcImage[temp]);
theLoader.addListener(theListener);
mcImage[temp]._alpha = 0;
}
};
// -----=-=-=-=-=-=-=-=-=-=-==-=-=-
//************ XML PROCESSING ************
// -----=-=-=-=-=-=-=-=-=-=-==-=-=-
function processImageXMLData(success) {
if (success) {
var Title = this.firstChild.childNodes[0].firstChild;
var frontOfURL = this.firstChild.childNodes[2].firstChild;
var total = (xmlImages.firstChild.childNodes.length)-3;
var NumOrows = Math.round(Math.sqrt(total));
var NumPerRow = Math.ceil(Math.sqrt(total));
for (counter=1; counter<=total; counter++) {
entryNum = counter+2;
ImageArrayNum = counter-1;
bucket[ImageArrayNum] = new Array(xmlImages.firstChild.childNodes[entryNum].childNodes[1].childNodes[0], xmlImages.firstChild.childNodes[entryNum].childNodes[2].childNodes[0], xmlImages.firstChild.childNodes[entryNum].childNodes[3].childNodes[0]);
//trace(bucket[ImageArrayNum][0]);// returns Small url
//trace(bucket[ImageArrayNum][1]);// returns large url
//trace(bucket[ImageArrayNum][2]);// returns Description
}
theLoadAdder.loademUp(bucket);
} else {
trace("XML LOADER error");
}
}
// -----=-=-=-=-=-=-=-=-=-=-==-=-=-
//************ the ACTIONS ************
// -----=-=-=-=-=-=-=-=-=-=-==-=-=-

this.createEmptyMovieClip("mcImage", 10);
this.createTextField("loadedText", 100, 200, 200, 250, 20);
this.createEmptyMovieClip("maskerMC", -1000);
// ________ COUNTER VARIABLES
var tempInt = 0;
var tempInt2 = 0;
var total;
var nextX=0;
var nextY=0;
var activation=0;
// ________ BUCKET FOR ARRAYS
var bucket = new Array();
// ________ Load and process XML
xmlImages.ignoreWhite = true;
xmlImages.onLoad = processImageXMLData;
xmlImages.load("xmlImages.xml");
stop();


I can post the fla, but this is almost the entire thing, the only thing that is missing is the buttons and the mover MC to scroll the movie (which has no problems).

Joe$

Navarone
09-12-2005, 08:51 PM
Can you do any traces or comment out code to maybe narrow down the problem. I am not that familar with XML, so I don't know if I can be of much help. :)

JoeMoney
09-13-2005, 04:58 AM
Not sure why but now I can't re-create the problem when the movie, the xml file, and the JPEGs all live on the server.

I feel like I am taking crazy pills.

Joe$