Phaser 4 examples

Loader Events

  • 13 examples

Examples 13

Add Files During LoadDemonstrates how to dynamically add new assets to the loader queue from within a loader event callback while the loading process is already in progress.Destroy Game During LoadDemonstrates how to safely destroy a Phaser game instance while the Loader is actively processing a queue of assets.Display File As LoadedDemonstrates using the loader 'filecomplete' event to add images to the scene immediately after they finish loading while sequentially triggering the next load.File Complete EventLearn how to use the 'filecomplete' event on an individual file loader to execute a callback as soon as a specific asset has finished loading.File Complete Event with KeyLearn how to use specific file completion events to trigger actions as soon as a particular asset finishes loading, using the 'filecomplete-type-key' event string.File Progress EventLearn how to use the 'fileprogress' event to monitor the loading progress of a specific individual file within the Loader.Load Multiple ImagesDemonstrates loading a large quantity of individual image assets and displaying them by iterating through all keys in the texture manager.Loader Duplicate File HandlingDemonstrates how the Loader handles requests for files that are already in the cache, verifying that the 'complete' event still fires correctly when no new files need to be processed.Loader Progress BarDemonstrates how to use the loader's progress event to create a visual loading bar while assets are being loaded.Loading Assets from External URLsDemonstrates how to load assets using absolute URLs, which bypasses the loader's setBaseURL and setPath settings to fetch files from different domains.Multi-File Loader ProgressLearn how to use the fileprogress event to track and display the individual loading progress of multiple assets in the loader queue.Play Animation During LoadLearn how to use the Scene 'pack' property to load a spritesheet early, enabling an animated loading screen while a large batch of secondary assets is being processed.Start Loader ManuallyDemonstrates how to initiate the loader manually using this.load.start() outside of the preload function, including how to dynamically add files to the load queue as others finish.