Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few things I noticed, you are only listening for Event.COMPLETE and IOErrorEvent.IO_ERROR. I'd suggest also listening for HTTPStatusEvent.HTTP_STATUS, Event.OPEN, though I haven't added those in, they may provide useful information if you still aren't getting anywhere.</p> <p>You should not need a LoaderContext object if you are only loading images and not accessing their content, so that (security) really should not be a problem. You should definitely separate out your logic in imageLoaded so that it is not both the initiator and the completion handler for your Loaders.</p> <p>Anyway, no clue if this will be of use to you, but I've made your code substantially more readable and reworked some things that made little sense.</p> <pre><code>public static const LOADLIMIT:int = 4; private var paramObj:Object; private var imageRequests:Vector.&lt;URLRequest&gt;; private var loaderObj:Vector.&lt;Loader&gt;; private var nextToLoad:int = -1; public function Player(){ paramObj = loaderInfo.parameters; //what is this all about, your backup URL is useless? if (!paramObj.root) { paramObj.root = "http://site.com/images/"; } var res = bootstrapImages(); if (res.length &gt; 0){ loadErrorMsg.text = res; loadErrorMsg.visible = true; //log.log kills me log.log(res); } } private function bootstrapImages():String { try { var req:URLRequest = new URLRequest(paramObj.root + "getdirlist.php?name=" + paramObj.imgloc); var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, directoryLoaded); loader.addEventListener(IOErrorEvent.IO_ERROR, dataIOError); loader.load(req); } catch (ex:Error) { log.log(ex); } return ""; } private function directoryLoaded(e:Event):void{ trace(e.target.data); try { var items:Array = JSON.decode(e.target.data); } catch (ex:Error){ trace (ex.getStackTrace()); loadErrorMsg.text = "Error parsing album data."; loadErrorMsg.visible = true; log.log(ex); return; } if (items.length == 0){ loadErrorMsg.text = "Invalid album name"; loadErrorMsg.visible = true; log.log("Items length is 0."); return; } imageRequests = new Vector.&lt;URLRequest&gt;(); loaderObj = new Vector.&lt;Loader&gt;(); for each(var item:String in items){ imageRequests.push(new URLRequest(paramObj.root+"coffeeimages/"+paramObj.imgloc+"/"+item)); loaderObj.push(new Loader()); } for (var i:int = 0; i &lt; LOADLIMIT; i++){ loadNextImage(); } } private function loadNextImage():void { nextToLoad++; if (nextToLoad &lt; imageRequests.length) { loaderObj[nextToLoad].contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); loaderObj[nextToLoad].contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, dataIOError); try { loaderObj[nextToLoad].load(imageRequests[nextToLoad]); } catch (e:Error) { log.log(ex); } log.addObjectWatch(loaderObj[nextToLoad]); } } private function dataIOError(e:IOError):void { loadErrorMsg.text = "IOError: " + e.errorID + " - " + e.name + ", " + e.message; loadErrorMsg.visible = true; log.log(ex); } private function imageLoaded(e:Event){ //Start the slideshow if the first image has loaded loadNextImage(); if (e.target == loaderObj[0]) { trace(loaderObj[0].contentLoaderInfo.bytesLoaded, loaderObj[0].contentLoaderInfo.bytesTotal); loadErrorMsg.visible = false; playSlideshow(true); } } </code></pre> <p><strong>Edit:</strong> You may simply wish to scrap your loading code entirely and instead use <a href="http://code.google.com/p/bulk-loader/" rel="nofollow noreferrer">Bulk Loader</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload