Namespace: FileTypes

Phaser.Loader. FileTypes

Classes

AnimationJSONFile
AtlasJSONFile
AtlasXMLFile
AudioFile
AudioSpriteFile
BinaryFile
BitmapFontFile
GLSLFile
HTML5AudioFile
HTMLFile
HTMLTextureFile
ImageFile
JSONFile
MultiAtlasFile
PackFile
PluginFile
SceneFile
ScenePluginFile
ScriptFile
SpriteSheetFile
SVGFile
TextFile
TilemapCSVFile
TilemapImpactFile
TilemapJSONFile
UnityAtlasFile
XMLFile

Type Definitions


AtlasJSONFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

textureURL string <optional>

The absolute or relative URL to load the texture image file from.

textureExtension string <optional>
'png'

The default file extension to use for the image texture if no url is provided.

textureXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the texture image file.

normalMap string <optional>

The filename of an associated normal map. It uses the same path and url to load as the texture image.

atlasURL string <optional>

The absolute or relative URL to load the atlas json file from. Or a well formed JSON object to use instead.

atlasExtension string <optional>
'json'

The default file extension to use for the atlas json if no url is provided.

atlasXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the atlas json file.

Source: src/loader/filetypes/AtlasJSONFile.js (Line 15)

AtlasXMLFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

textureURL string <optional>

The absolute or relative URL to load the texture image file from.

textureExtension string <optional>
'png'

The default file extension to use for the image texture if no url is provided.

textureXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the texture image file.

normalMap string <optional>

The filename of an associated normal map. It uses the same path and url to load as the texture image.

atlasURL string <optional>

The absolute or relative URL to load the atlas xml file from.

atlasExtension string <optional>
'xml'

The default file extension to use for the atlas xml if no url is provided.

atlasXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the atlas xml file.

Source: src/loader/filetypes/AtlasXMLFile.js (Line 15)

AudioFileConfig

Type:
  • object
Properties:
Name Type Argument Description
key string

The key of the file. Must be unique within the Loader and Audio Cache.

urlConfig string <optional>

The absolute or relative URL to load the file from.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

audioContext AudioContext <optional>

The AudioContext this file will use to process itself.

Source: src/loader/filetypes/AudioFile.js (Line 15)

AudioSpriteFileConfig

Type:
  • object
Properties:
Name Type Argument Description
key string

The key of the file. Must be unique within both the Loader and the Audio Cache.

jsonURL string

The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead.

jsonXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the json file.

audioURL Object <optional>

The absolute or relative URL to load the audio file from.

audioConfig any <optional>

The audio configuration options.

audioXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the audio file.

Source: src/loader/filetypes/AudioSpriteFile.js (Line 15)

BinaryFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Binary Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'bin'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

dataType any <optional>

Optional type to cast the binary file to once loaded. For example, Uint8Array.

Source: src/loader/filetypes/BinaryFile.js (Line 14)

BitmapFontFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

textureURL string <optional>

The absolute or relative URL to load the texture image file from.

textureExtension string <optional>
'png'

The default file extension to use for the image texture if no url is provided.

textureXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the texture image file.

normalMap string <optional>

The filename of an associated normal map. It uses the same path and url to load as the texture image.

fontDataURL string <optional>

The absolute or relative URL to load the font data xml file from.

fontDataExtension string <optional>
'xml'

The default file extension to use for the font data xml if no url is provided.

fontDataXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the font data xml file.

Source: src/loader/filetypes/BitmapFontFile.js (Line 16)

GLSLFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Text Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'glsl'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/GLSLFile.js (Line 14)

HTMLFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Text Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'html'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/HTMLFile.js (Line 14)

HTMLTextureFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'html'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

width integer <optional>
512

The width of the texture the HTML will be rendered to.

height integer <optional>
512

The height of the texture the HTML will be rendered to.

Source: src/loader/filetypes/HTMLTextureFile.js (Line 14)

ImageFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'png'

The default file extension to use if no url is provided.

normalMap string <optional>

The filename of an associated normal map. It uses the same path and url to load as the image.

frameConfig Phaser.Loader.FileTypes.ImageFrameConfig <optional>

The frame configuration object. Only provided for, and used by, Sprite Sheets.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/ImageFile.js (Line 25)

ImageFrameConfig

Type:
  • object
Properties:
Name Type Argument Default Description
frameWidth integer

The width of the frame in pixels.

frameHeight integer <optional>

The height of the frame in pixels. Uses the frameWidth value if not provided.

startFrame integer <optional>
0

The first frame to start parsing from.

endFrame integer <optional>

The frame to stop parsing at. If not provided it will calculate the value based on the image and frame dimensions.

margin integer <optional>
0

The margin in the image. This is the space around the edge of the frames.

spacing integer <optional>
0

The spacing between each frame in the image.

Source: src/loader/filetypes/ImageFile.js (Line 14)

JSONFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the JSON Cache.

url string | any <optional>

The absolute or relative URL to load the file from. Or can be a ready formed JSON object, in which case it will be directly added to the Cache.

extension string <optional>
'json'

The default file extension to use if no url is provided.

dataKey string <optional>

If specified instead of the whole JSON file being parsed and added to the Cache, only the section corresponding to this property key will be added. If the property you want to extract is nested, use periods to divide it.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/JSONFile.js (Line 15)

MultiAtlasFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

atlasURL string <optional>

The absolute or relative URL to load the multi atlas json file from. Or, a well formed JSON object.

atlasExtension string <optional>
'json'

The default file extension to use for the atlas json if no url is provided.

atlasXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the atlas json file.

path string <optional>

Optional path to use when loading the textures defined in the atlas data.

baseURL string <optional>

Optional Base URL to use when loading the textures defined in the atlas data.

textureXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the texture files.

Source: src/loader/filetypes/MultiAtlasFile.js (Line 15)

PackFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the JSON Cache.

url string | any <optional>

The absolute or relative URL to load the file from. Or can be a ready formed JSON object, in which case it will be directly processed.

extension string <optional>
'json'

The default file extension to use if no url is provided.

dataKey string <optional>

If specified instead of the whole JSON file being parsed, only the section corresponding to this property key will be added. If the property you want to extract is nested, use periods to divide it.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/PackFile.js (Line 12)

PluginFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within the Loader.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'js'

The default file extension to use if no url is provided.

start boolean <optional>
false

Automatically start the plugin after loading?

mapping string <optional>

If this plugin is to be injected into the Scene, this is the property key used.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/PluginFile.js (Line 14)

SceneFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Text Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'txt'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/SceneFile.js (Line 14)

ScenePluginFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within the Loader.

url string | function <optional>

The absolute or relative URL to load the file from. Or, a Scene Plugin.

extension string <optional>
'js'

The default file extension to use if no url is provided.

systemKey string <optional>

If this plugin is to be added to Scene.Systems, this is the property key for it.

sceneKey string <optional>

If this plugin is to be added to the Scene, this is the property key for it.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/ScenePluginFile.js (Line 14)

ScriptFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within the Loader.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'js'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/ScriptFile.js (Line 14)

SpriteSheetFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'png'

The default file extension to use if no url is provided.

normalMap string <optional>

The filename of an associated normal map. It uses the same path and url to load as the image.

frameConfig Phaser.Loader.FileTypes.ImageFrameConfig <optional>

The frame configuration object.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/SpriteSheetFile.js (Line 11)

SVGFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'svg'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

svgConfig Phaser.Loader.FileTypes.SVGSizeConfig <optional>

The svg size configuration object.

Source: src/loader/filetypes/SVGFile.js (Line 22)

SVGSizeConfig

Type:
  • object
Properties:
Name Type Argument Description
width integer <optional>

An optional width. The SVG will be resized to this size before being rendered to a texture.

height integer <optional>

An optional height. The SVG will be resized to this size before being rendered to a texture.

scale number <optional>

An optional scale. If given it overrides the width / height properties. The SVG is scaled by the scale factor before being rendered to a texture.

Source: src/loader/filetypes/SVGFile.js (Line 14)

TextFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Text Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'txt'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/TextFile.js (Line 14)

TilemapCSVFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Tilemap Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'csv'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/TilemapCSVFile.js (Line 15)

TilemapImpactFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Tilemap Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'json'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/TilemapImpactFile.js (Line 12)

TilemapJSONFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Tilemap Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'json'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/TilemapJSONFile.js (Line 12)

UnityAtlasFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Texture Manager.

textureURL string <optional>

The absolute or relative URL to load the texture image file from.

textureExtension string <optional>
'png'

The default file extension to use for the image texture if no url is provided.

textureXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the texture image file.

normalMap string <optional>

The filename of an associated normal map. It uses the same path and url to load as the texture image.

atlasURL string <optional>

The absolute or relative URL to load the atlas data file from.

atlasExtension string <optional>
'txt'

The default file extension to use for the atlas data if no url is provided.

atlasXhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for the atlas data file.

Source: src/loader/filetypes/UnityAtlasFile.js (Line 15)

XMLFileConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key of the file. Must be unique within both the Loader and the Text Cache.

url string <optional>

The absolute or relative URL to load the file from.

extension string <optional>
'xml'

The default file extension to use if no url is provided.

xhrSettings XHRSettingsObject <optional>

Extra XHR Settings specifically for this file.

Source: src/loader/filetypes/XMLFile.js (Line 15)