Hi list, I am facing a problem I can´t solve, and since now, thanks a lot for any help.
I am loading images and preloading them...ok, nothing new. For this, I am using loadClip and onLoadProgress to update their bytesLoaded and bytesTotal, so I can preload them perfectly. The amount of images to load, vary according to the clicked item. When I try this local, works perfectly, the bytes amount are updated as it should, but when I try it online, it just doesn´t work. When I load images and they are not cached: getBytesLoaded returns: undefined getBytesTotal returns: undefined But when they finish to load, and when they start to load when already cached: getBytesLoaded returns: correct size getBytesTotal returns: always 0 Here is the code: var mcl:MovieClipLoader = new MovieClipLoader(); var listener:Object = new Object(); mcl.addListener(listener); var totalLoaded = 0; var loaderTime = 0; function loadImagesToHolders() { var totalToLoad = txtImagensServicosXML[dataID1][dataID2].length; //totalImgsToLoad doubles cause it loads both mini and big images var totalImgsToLoad = totalToLoad*2; totalLoaded = 0; listener.onLoadComplete = function(mc:MovieClip):Void { totalLoaded++; var id1 = mc._name.slice(5, 6); var id2 = mc._name.slice(7, 8); if (totalLoaded == totalImgsToLoad) { clientes.onEnterFrame = function() { if (barFullandLoaded == true) { this.onEnterFrame = null; barFullandLoaded = false; if (processStopped == false) { loader.bar.gotoAndStop(1); clientesLoaded(); } } }; } }; //waste of code, temp used cause of old problems mcTotalLoaded = null; mcTotalSize = null; totalL = null; totalS = null; //end of waste of code var mcTotalLoaded:Array = new Array(totalToLoad); var mcTotalSize:Array = new Array(totalToLoad); var thePercent = 0; var barFullandLoaded = false; listener.onLoadProgress = function(mc:MovieClip):Void { var mcID = mc._name.slice(-1); mcTotalLoaded[mcID] = mc.getBytesLoaded (); mcTotalSize[mcID] = mc.getBytesTotal(); }; loaderTimer = getTimer(); loader.onEnterFrame = function() { totalL = 0; totalS = 0; for (var i:Number = 0; i<totalToLoad; i++) { totalL += mcTotalLoaded[i]; totalS += mcTotalSize[i]; } thePercent = Math.ceil((totalL/totalS)*100); if (thePercent>(loader.bar._currentframe*2) && loader.bar._currentframe<50) { loader.bar.play(); } else { loader.bar.stop(); } if (loader._visible == true) { if (thePercent>=100 && loader.bar._currentframe == 50) { barFullandLoaded = true; loader.onEnterFrame = null; } } else { if (thePercent>=100 && getTimer()>=Number(loaderTimer+1000)) { barFullandLoaded = true; loader.onEnterFrame = null; } } if (getTimer()>=Number(loaderTimer+2000) && loader.bar._currentframe<=45) { loader._visible = true; } }; for (var i:Number = 0; i<totalToLoad; i++) { clientes.createEmptyMovieClip("img_p"+dataID1+"_"+dataID2+"_"+i, clientes.getNextHighestDepth()); clientes["img_p"+dataID1+"_"+dataID2+"_"+i]._x = 2000; clientes.createEmptyMovieClip("img_g"+dataID1+"_"+dataID2+"_"+i, clientes.getNextHighestDepth()); clientes["img_g"+dataID1+"_"+dataID2+"_"+i]._x = 2000; mcl.loadClip(txtImagensServicosXML[dataID1][dataID2][i][0],clientes["img_p"+dataID1+"_"+dataID2+"_"+i]); mcl.loadClip (txtImagensServicosXML[dataID1][dataID2][i][1],clientes["img_g"+dataID1+"_"+dataID2+"_"+i]); } } Thanks a lot for any help! Helios
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com