Packageflare.system
Classpublic class Library3D
InheritanceLibrary3D Inheritance flash.events.EventDispatcher
Implements ILibraryExternalItem

The Library3D class loads and manages the resources used by 3d objects.



Public Properties
 PropertyDefined By
  allowEventsAfterComplete : Boolean
Allow to fire events (progress and complete) after the first complete event were dispatched.
Library3D
  bytesLoaded : uint
[read-only] Returns the amount of bytes loaded.
Library3D
  bytesTotal : uint
[read-only] Returns the amount of bytes that will be loaded.
Library3D
  items : Vector.<ILibraryItem>
[read-only] Returns a copy of the stored items.
Library3D
  itemsToLoad : Vector.<ILibraryExternalItem>
[read-only] Returns a copy of the stored items to be loaded.
Library3D
  loaded : Boolean
[read-only]
Library3D
  progress : Number
[read-only] Returns the global progress of all the resources being currently loaded.
Library3D
  request : *
[read-only]
Library3D
Public Methods
 MethodDefined By
  
Library3D(connections:int = 10, autoStart:Boolean = true, allowEventsAfterComplete:Boolean = true)
Creates a new library object.
Library3D
  
Adds a new item to the library.
Library3D
  
close():void
Closes all connections.
Library3D
  
dispose():void
Eliminates cached resources.
Library3D
  
Returns an item instance previosuly associated to a path.
Library3D
  
load():void
Start downloading.
Library3D
  
Loads a new item object.
Library3D
  
Removes an item from the library.
Library3D
  
reset():void
Removes all items and clean all references.
Library3D
Events
 Event Summary Defined By
  This event occurs once the loading process of all the library elements has been completed.Library3D
  Dispatched if a call to load() results in a fatal error that terminates the download.Library3D
  This event occurs whenever the loading progress of the elements of a library is modified.Library3D
  This event occurs when the library has been updated.Library3D
Property Detail
allowEventsAfterCompleteproperty
allowEventsAfterComplete:Boolean

Allow to fire events (progress and complete) after the first complete event were dispatched. It can be used to load multiple packages.


Implementation
    public function get allowEventsAfterComplete():Boolean
    public function set allowEventsAfterComplete(value:Boolean):void
bytesLoadedproperty 
bytesLoaded:uint  [read-only]

Returns the amount of bytes loaded.


Implementation
    public function get bytesLoaded():uint
bytesTotalproperty 
bytesTotal:uint  [read-only]

Returns the amount of bytes that will be loaded.


Implementation
    public function get bytesTotal():uint
itemsproperty 
items:Vector.<ILibraryItem>  [read-only]

Returns a copy of the stored items.


Implementation
    public function get items():Vector.<ILibraryItem>
itemsToLoadproperty 
itemsToLoad:Vector.<ILibraryExternalItem>  [read-only]

Returns a copy of the stored items to be loaded.


Implementation
    public function get itemsToLoad():Vector.<ILibraryExternalItem>
loadedproperty 
loaded:Boolean  [read-only]


Implementation
    public function get loaded():Boolean
progressproperty 
progress:Number  [read-only]

Returns the global progress of all the resources being currently loaded. Once the 'complete' event has been received, it will be set back to zero and a new progress stage will begin if new resources are loaded only if allowEventsAfterComplete is seted to true in the class constructor,


Implementation
    public function get progress():Number
requestproperty 
request:*  [read-only]


Implementation
    public function get request():*
Constructor Detail
Library3D()Constructor
public function Library3D(connections:int = 10, autoStart:Boolean = true, allowEventsAfterComplete:Boolean = true)

Creates a new library object.

Parameters
connections:int (default = 10) — The number of connections used for download at the same time.
 
autoStart:Boolean (default = true) — Define if the library starts automatically to download the files when the first file is added.
 
allowEventsAfterComplete:Boolean (default = true) — Allow to fire events (progress and complete) after the first complete events. It can be used to load multiple packages.
Method Detail
addItem()method
public function addItem(key:*, item:ILibraryItem):ILibraryItem

Adds a new item to the library. This method asociates the item instance to a key-path to be used with the getItem() method. Also adds the item to a collecion of items. This method isn't related to the loading proccess, just stores the items for future use. To add items to the loading queue, use the push method.

Parameters

key:* — Path or key to associate the item.
 
item:ILibraryItem — The item instance.

Returns
ILibraryItem

See also

close()method 
public function close():void

Closes all connections.

dispose()method 
public function dispose():void

Eliminates cached resources.

getItem()method 
public function getItem(key:*):ILibraryItem

Returns an item instance previosuly associated to a path.

Parameters

key:* — Path of the item instance.

Returns
ILibraryItem — The item corresponding to the path, null othwrwise.

See also

load()method 
public function load():void

Start downloading. If autoStart propery was seted to true in the constructor, this method will be automatically called when loads the first file.

push()method 
public function push(item:ILibraryExternalItem):ILibraryExternalItem

Loads a new item object. If the item can not be loaded inmediately (depending of the amount of available connections), it will be added to a queue to be load when connections are available.

Parameters

item:ILibraryExternalItem

Returns
ILibraryExternalItem — true if was sucesful, false otherwise.
removeItem()method 
public function removeItem(key:*):ILibraryItem

Removes an item from the library. This method removes the association of an item instance with its key-path that is used with the getItem() method. Also removes the item from the collecion of items. This method isn't related to the loading proccess, just stores the items for future use.

Parameters

key:* — Path or key to associate the item.

Returns
ILibraryItem — The removed item if any.
reset()method 
public function reset():void

Removes all items and clean all references.

Event Detail
complete Event
Event Object Type: flash.events.Event
Event.type property = flash.events.Event

This event occurs once the loading process of all the library elements has been completed.

ioError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.IO_ERROR

Dispatched if a call to load() results in a fatal error that terminates the download.

progress Event  
Event Object Type: flash.events.ProgressEvent
ProgressEvent.type property = flash.events.Event

This event occurs whenever the loading progress of the elements of a library is modified.

updated Event  
Event Object Type: flash.events.Event
Event.type property = flash.events.Event

This event occurs when the library has been updated.