Dear, Dear, re:Dear Helios, When at first you don't succeed, reply to yourself. Ok, so here is something I just stumbled across called PreloadAssetManager - but I haven't used it yet. Probably because although Jack Doyle has been rockn' the 3k range he's still missing the sexy examples like Papervision3D with Tweener: http://labs.blitzagency.com/?p=314. ;)
PreloadAssetManager An Intelligent Preloading Queue http://blog.greensock.com/preloadassetmanageras2/ DESCRIPTION Provides an easy way to invisibly preload SWFs, FLVs, or images and optionally trigger a callback function when preloading has finished. It also provides _width and _height information for all successfully preloaded SWFs or images, and duration information for FLVs (assuming they were encoded properly and have MetaData). By default, it will initially only load enough of each asset to determine the size (bytes) of each asset so that it can accurately report the percentLoaded_num, getBytesLoaded() and getBytesTotal(), then it loops back through from the beginning and finishes all the preloading. If you're not going to use a preloader status bar that polls these methods/properties, you can just set the trackProgress_boolean property to false to skip that initial delay. * Compatibility: Flash Player 6 and later (ActionScript 2.0) (FLV preloading requires Flash Player 7) * File Size added to published SWF: About 3Kb _____________________________ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _____________________________ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Helios Pregioni Bayma Sent: Tuesday, June 12, 2007 11:08 AM To: [email protected] Subject: [Flashcoders] Re: getBytes...() works only local,not online (except when imgs are cached) 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 > _______________________________________________ [email protected] 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

