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
  loaded : Boolean
[read-only]
Library3D
  progress : Number
[read-only] Returns the global progress of all the resources being currently loaded.
Library3D
Public Methods
 MethodDefined By
  
Library3D(connections:int = 2, autoStart:Boolean = true, allowEventsAfterComplete:Boolean = true)
Creates a new library object.
Library3D
  
addItem(path:String, item:ILibraryItem):void
Adds a new item to the library.
Library3D
  
close():void
Closes all connections.
Library3D
  
dispose():void
Eliminates cached resources.
Library3D
  
getItem(path:String):ILibraryItem
Returns an item instance previosuly associated to a path.
Library3D
  
load():void
Start downloading.
Library3D
  
Loads a new item object.
Library3D
  
reset():void
Removes all items and clean all references.
Library3D
Events
 Event Summary Defined By
  This event occurs at 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>
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
Constructor Detail
Library3D()Constructor
public function Library3D(connections:int = 2, autoStart:Boolean = true, allowEventsAfterComplete:Boolean = true)

Creates a new library object.

Parameters
connections:int (default = 2) — 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(path:String, item:ILibraryItem):void

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.

Parameters

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

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(path:String):ILibraryItem

Returns an item instance previosuly associated to a path.

Parameters

path:String — 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.
reset()method 
public function reset():void

Removes all items and clean all references.

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

This event occurs at the library has been updated.