Flash failing to fire any Events on URLLoader sometimes
I have an instance of URLLoader that works perfectly on my machine and a number of other machines, but in a few rare cases, regardless of the browser or the flash player version, URLLoader never comes back with any of my callbacks and so the load() method is fired off into the stratosphere and nothing happens beyond that.
Curious if anyone else has encountered this and if so how they got around it.
[EDIT]
Ok... never mind on the "no callbacks are fired". In fact it is firing the SecurityError.SECURITY_ERROR. However, I'm at a total loss as to why it would only fire this on some machines and not on others. Does it have something to do with the user's admin privileges o开发者_如何转开发r the browser's security settings? The error is 2170, phaseTwo (whatever that means)
[EDIT 2]
EUREKA!!! To www or not to www that is the question (or rather the answer). The issue had nothing to do with computers, but rather with the page being loaded without the www in some instances. Flash doesn't know what to do in that situation. Brilliant!
Three things come to mind that could cause this:
Make sure you are catching SecurityError.SECURITY_ERROR
and IOError.IO_ERROR
. If an error occurs, the COMPLETE
event won't be raised.
If Loader
is not added to the UI-tree, it won't work. If that's the case, you should be using URLLoader
instead.
If you are adding the event listeners using addEventListener
, make sure you are not using weak references. If you are, and aren't rooted, they could be garbage collected which would cause your symptoms.
Without seeing code, from what you describe it seems that your loader could be collected before it fires any events. If your loader is stored in a local variable, try to move to a class instance variable (and perhaps seeing some code could help).
The above problem (which may or may not be the problem here) is not common in practice, in my experience, but it's definitely possible (I've seen this myself). I'm not sure under what exact circumstances it happens. I think an active loader will not be collected. But I'm not sure an active loader for the player is the same as an active loader from an Actionscript perspective. Meaning, from you AS code, an active loader would be a loader on which you have invoked the load method and has not yet finished loading (with or without errors). Now, for the player (again, this is a -hopefully educated- guess), active could mean something different. You can download only 2 assets from one domain simultaneously (a browser restriction); if you try to load more stuff, these operations are queued by the player. So maybe, a loader on which you have called load but has not actually begun the real loading, is not considered active by the player and so it's collectable.
精彩评论