Share Posted June 18, 2010 Hi I have an alternate URL in case the image path I am supplying to the loader is invalid, however I am unsure how to detect it onChildOpen before it throws the error and use replaceURL to provide the backup path. So basically the error is detected using this. imagesQueue = new LoaderMax({name: imagesQueue, requireWithRoot: this.root, onChildOpen: initHandler, onIOError: IOErrorHandler, onChildComplete: childCompleteHandler, autoDispose: true}); imagesQueue.append(new ImageLoader(imagePath, {name: nodes.title, container: imageHolder})); function IOErrorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } basically I'd like the IOErrorHandler to say, well If this URL stream is not valid and an image isn't found in here then try this other one. if (image != null) { imagePath = String(nodes.collectionImageResizePath); } else { imagePath = String(nodes.collectionImagePath); } So if the path I tried doesn't find an image then try the alternate path... I looked over at the skipFailed vars and set it to false, and I don't know how to supply an alternate. Thanks in advance for any help on this issue. All the best Fernando. Link to comment Share on other sites More sharing options...
Share Posted June 19, 2010 I have good news for you: I just posted an update (v1.11) that introduces a new "alternateURL" special property in all LoaderItems so it should be SUPER simple to do what you're talking about. Like this: var loader:ImageLoader = new ImageLoader("image.jpg", {alternateURL:"http://otherserver.com/image.jpg"}); It will first try to load from image.jpg, then if it fails, it will change the url to the alternateURL and try once more. Cool? Link to comment Share on other sites More sharing options...
Author Share Posted June 19, 2010 Cool ;Jack! I just wish I was half as clever as you are! Thanks much! Link to comment Share on other sites More sharing options...
Share Posted July 22, 2010 I can't seem to get the alternateURL working from within a SWFLoader XML node: Should this line work? Link to comment Share on other sites More sharing options...
Share Posted July 22, 2010 Yeah, are you using the latest version of everything? alternateURL was introduced after the initial launch. You did activate() SWFLoader, right? If you're still having trouble, can you post an FLA that we can publish and clearly see the problem? (the simpler the better) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now