Options
Menu

Class Loader

Loader can load any file format that away.supports (or for which a third-party parser has been plugged in) and it's dependencies. Events are dispatched when assets are encountered and for when the resource (or it's dependencies) have been loaded.

The Loader will not make assets available in any other way than through the dispatched events. To store assets and make them available at any point from any module in an application, use the AssetLibrary to load and manage assets.

see

away.library.AssetLibrary

Hierarchy

Index

Constructors

constructor

  • new Loader(materialMode?: number): Loader
  • Create a new ResourceLoadSession object.

    Parameters

    • Default value materialMode: number = 0

    Returns Loader

Accessors

baseDependency

  • Returns the base dependency of the loader

    Returns ResourceDependency

loaderInfo

  • Returns a LoaderInfo object corresponding to the object being loaded. LoaderInfo objects are shared between the Loader object and the loaded content object. The LoaderInfo object supplies loading progress information and statistics about the loaded file.

    Events related to the load are dispatched by the LoaderInfo object referenced by the contentLoaderInfo property of the Loader object. The contentLoaderInfo property is set to a valid LoaderInfo object, even before the content is loaded, so that you can add event listeners to the object prior to the load.

    To detect uncaught errors that happen in a loaded SWF, use the Loader.uncaughtErrorEvents property, not the Loader.contentLoaderInfo.uncaughtErrorEvents property.

    Returns LoaderInfo

Methods

_iAddErrorHandler

  • _iAddErrorHandler(handler: any): void
  • Parameters

    • handler: any

    Returns void

Private _iAddParseErrorHandler

  • _iAddParseErrorHandler(handler: any): void
  • Parameters

    • handler: any

    Returns void

addEventListener

  • addEventListener(type: string, listener: function): void
  • Add an event listener

    method

    addEventListener

    Parameters

    • type: string
    • listener: function

    Returns void

dispatchEvent

hasEventListener

  • hasEventListener(type: string, listener?: function): boolean
  • check if an object has an event listener assigned to it

    method

    hasListener

    Parameters

    • type: string
    • Optional listener: function

    Returns boolean

load

  • Loads a file and (optionally) all of its dependencies.

    Parameters

    • req: URLRequest

      The URLRequest object containing the URL of the file to be loaded.

    • Default value context: LoaderContext = null

      An optional context object providing additional parameters for loading

    • Default value ns: string = null

      An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets

    • Default value parser: ParserBase = null

      An optional parser object for translating the loaded data into a usable resource. If not provided, Loader will attempt to auto-detect the file type.

    Returns void

loadData

  • Loads a resource from already loaded data.

    Parameters

    • data: any

      The data object containing all resource information.

    • id: string
    • Default value context: LoaderContext = null

      An optional context object providing additional parameters for loading

    • Default value ns: string = null

      An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets

    • Default value parser: ParserBase = null

      An optional parser object for translating the loaded data into a usable resource. If not provided, Loader will attempt to auto-detect the file type.

    Returns void

removeEventListener

  • removeEventListener(type: string, listener: function): void
  • Remove an event listener

    method

    removeEventListener

    Parameters

    • type: string
    • listener: function

    Returns void

stop

  • stop(): void
  • Returns void

Static enableParser

  • enableParser(parser: any): void
  • Enables a specific parser. When no specific parser is set for a loading/parsing opperation, loader3d can autoselect the correct parser to use. A parser must have been enabled, to be considered when autoselecting the parser.

    see

    away.parsers.Parsers

    Parameters

    • parser: any

      The parser export class to enable.

    Returns void

Static enableParsers

  • enableParsers(parsers: Array<Object>): void
  • Enables a list of parsers. When no specific parser is set for a loading/parsing opperation, Loader can autoselect the correct parser to use. A parser must have been enabled, to be considered when autoselecting the parser.

    see

    away.parsers.Parsers

    Parameters

    • parsers: Array<Object>

      A Vector of parser classes to enable.

    Returns void

Generated using TypeDoc