Jump to content
Search Community

2 Questions: FAIL vs ERROR Event

Urda test
Moderator Tag

Recommended Posts

Hi Jack,

 

Best ever Loader around, good docs and classes are almost self-explanatory.

Thanks a lot, works like a charm.

 

Yet i have 2 questions:

 

1) If something goes wrong when loading a LoaderItem (not nested in a LoaderMax-queue):

Which of the 2 Events is ALWAYS (last) fired ?

LoderEvent.FAIL or LoaderEvent.ERROR ?

I guess its FAIL, just want confirmation.

 

2) Is it safe to assume a Queue (LoaderMax) with at least one (or more) LoaderItems will ALWAYS fire a LoaderEvent.COMPLETE, no matter what, even if ALL its children fail to load anything?

 

The idea is to browse through myQueue.getChildrenByStatus(LoaderStatus.SOMESTATUS) once the queue is completed and not to worry about fixing individual children-contents before that.

 

Thx again.

Link to comment
Share on other sites

Best ever Loader around, good docs and classes are almost self-explanatory.

Thanks a lot, works like a charm.

Thank you kindly. Glad to hear it.

 

1) If something goes wrong when loading a LoaderItem (not nested in a LoaderMax-queue):

Which of the 2 Events is ALWAYS (last) fired ?

LoderEvent.FAIL or LoaderEvent.ERROR ?

I guess its FAIL, just want confirmation.

Yep, you are correct. FAIL would occur last.

 

2) Is it safe to assume a Queue (LoaderMax) with at least one (or more) LoaderItems will ALWAYS fire a LoaderEvent.COMPLETE, no matter what, even if ALL its children fail to load anything?

Yes, a LoaderMax will ALWAYS fire its LoaderEvent.COMPLETE event (eventually) even if all the children fail UNLESS you set its "skipFailed" property to false. By default it is true which is why it doesn't come to a screeching halt as soon as one child fails. The assumption is that in the vast majority of cases, you'd want the queue to continue on and complete even if one child (or more) fails. But again, if you want to change that behavior, it's very simple. That's precisely what "skipFailed" is for.

 

Does that clear things up for you?

Link to comment
Share on other sites

Yes, thats perfect. Thanks.

SkipFailed/skipPaused are nice features, so easy.

Bulkloader had a clunky fork version ("complete with errors") for that IIRC ;)

 

Just out of interest (i dont really need to know):

Is there any scenario when LaoderEvent.ERROR is fired and its not immediately followed by a LaoderEvent.FAIL ?

Link to comment
Share on other sites

Just out of interest (i dont really need to know):

Is there any scenario when LaoderEvent.ERROR is fired and its not immediately followed by a LaoderEvent.FAIL ?

Yep, there are a few cases like that, like when a security error gets thrown in a SWFLoader/ImageLoader that uses the default LoaderContext, it will throw an error, automatically fall back to a more restricted LoaderContext and try again (no FAIL unless that 2nd try fails). Also, if you define an alternateURL on a loader and the original url can't be found, an error will be thrown and then it'll automatically switch to the alternateURL without dispatching a FAIL event. If that alternateURL can't load, it will of course dispatch a FAIL event. An ERROR could be thrown when a swf/image is loaded and it is tested to determine if script access is allowed. If it's not, a SCRIPT_ACCESS_DENIED error is thrown but since the file did load, a FAIL event isn't dispatched.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...