Assets class is a wrapper around openfl.utils.Assets that provides safe access to asset loading functions with Funkin-specific caching.
Overview
The Assets class provides methods for loading:- Text files and binary data
- Images and bitmap data
- Sound effects and music
- Asset libraries
Properties
openfl.utils.IAssetCache
The OpenFL assets cache. Access directly for cache management.
Methods
getPath()
Returns the file system path for an asset.String
required
The asset path relative to the assets folder.
Text and Binary Assets
getText()
Loads text from an asset synchronously.String
required
The asset path to load from.
loadText()
Loads text from an asset asynchronously.String
required
The asset path to load from.
getBytes()
Loads binary data from an asset synchronously.String
required
The asset path to load from.
loadBytes()
Loads binary data from an asset asynchronously.String
required
The asset path to load from.
Image Assets
getBitmapData()
Loads a bitmap image synchronously.String
required
The asset path to load from.
Bool
default:"true"
Whether to use the asset cache. Set to false to force a fresh load.
loadBitmapData()
Loads a bitmap image asynchronously.String
required
The asset path to load from.
Audio Assets
getSound()
Loads a sound file synchronously.String
required
The asset path to load from.
loadSound()
Loads a sound file asynchronously.String
required
The asset path to load from.
getMusic()
Loads a music file synchronously with optimizations for long-duration audio.String
required
The asset path to load from.
loadMusic()
Loads a music file asynchronously with optimizations for long-duration audio.String
required
The asset path to load from.
Asset Library Management
exists()
Checks whether an asset exists.String
required
The asset path to check.
AssetType
The asset type to check (IMAGE, SOUND, TEXT, etc.).
list()
Retrieves a list of all assets of a given type.AssetType
The asset type to list. If omitted, lists all assets.
hasLibrary()
Checks if an asset library exists.String
required
The library name to check.
getLibrary()
Retrieves an asset library by name.String
required
The name of the library to get.
loadLibrary()
Loads an asset library asynchronously.String
required
The name of the library to load.
