What is the relationship between full and start events when using Loader?
The documentation for the Loader in ActionScript 3.0 link seems to be self-contradictory.
- The event is
complete
dispatched when the file has finished loading but before the available methods and properties of the loaded clips are available.
According to the first paragraph, the event complete
means that the file has finished downloading. We upload a file swf
and use an event complete
to signal that it has been uploaded. However, we find that in some cases the resources we download are not available to us. This line in the documentation makes a lot of sense to us why we are facing this problem and we planned to use instead init
.
But then the documentation goes on to say:
- The event is
init
dispatched after the properties and methods of the loaded SWF file are available, so you can start working on the loaded SWF file. This event is dispatched before the handlercomplete
. When streaming SWF files, the eventinit
can occur much earlier than the full event. Use a handler for most purposesinit
.
This also makes sense to us, except that it says the event is init
dispatched before the handler complete
. It doesn't make any sense to us because it seems to contradict itself. If the event is complete
dispatched before the available methods and properties of the loaded clips are available, and the event is init
dispatched after the properties and methods of the loaded SWF file are available, how can the event be dispatched init
before the event complete
?
I'd love to hear from someone who works with these events more often and can clarify the documentation on this. Here are my specific questions about this documentation and process:
- What is the difference between event values
complete
andinit
? - Is it important that the documentation uses the words "event" and "handler" here? those. "This event [
init
] is dispatched before the handlercomplete
." Does this mean that we have to deal with handling the eventcomplete
until the event is dispatchedinit
?
The documentation also clearly states, "For most purposes, use a handler init
." Therefore, at least we expect to change our software with help complete
to use init
. We'll probably just wait for both, especially if we see them arriving in different orders in our testing. But I'm still looking for common sense here. Hopefully someone can provide this?
source to share
Shouldn't you hook up event listeners to the Loader LoaderInfo object?
Event.COMPLETE documentation says:
Dispatched when data has been loaded successfully. In other words, this is sent when all content has been downloaded and the download has finished. The complete event is always dispatched after the init event. The init event is dispatched when the object is ready to be accessed, although content can still load.
Simplified explanation:
-
Event.INIT is dispatched when all "layers" (including code and assets) of the first frame are loaded
-
The .COMPLETE event is dispatched when all frames have finished loading.
source to share