Packageorg.papervision3d.materials.utils
Classpublic class MaterialsList

The MaterialsList class contains a list of materials.

Each MaterialsList object has its own materials list.



Public Properties
 PropertyDefined by
  materialsByName : Dictionary
List of materials indexed by name.
MaterialsList
  numMaterials : int
[read-only] Returns the number of children of this object.
MaterialsList
Protected Properties
 PropertyDefined by
  _materials : Dictionary
[internal-use] List of materials.
MaterialsList
Public Methods
 MethodDefined by
  
MaterialsList(materials:* = null)
Creates a list of materials.
MaterialsList
  
addMaterial(material:MaterialObject3D, name:String = null):MaterialObject3D
Adds a material to this MaterialsList object.
MaterialsList
  
Creates a copy of the materials list.
MaterialsList
  
Returns the material that exists with the specified name.
MaterialsList
  
Removes the specified material from the materials list.
MaterialsList
  
Removes the material that exists with the specified name.
MaterialsList
  
toString():String
Returns a string with the names of the materials in the list.
MaterialsList
Property detail
_materialsproperty
protected var _materials:Dictionary

[internal-use] List of materials.

materialsByNameproperty 
public var materialsByName:Dictionary

List of materials indexed by name.

numMaterialsproperty 
numMaterials:int  [read-only]

Returns the number of children of this object.

Implementation
    public function get numMaterials():int
Constructor detail
MaterialsList()constructor
public function MaterialsList(materials:* = null)

Creates a list of materials.

Parameters
materials:* (default = null) — An array or name indexed object with materials to populate the list with.
Method detail
addMaterial()method
public function addMaterial(material:MaterialObject3D, name:String = null):MaterialObject3D

Adds a material to this MaterialsList object.

Parameters
material:MaterialObject3D — The material to add.
 
name:String (default = null) — An optional name of the material. If no name is provided, the material name will be used.

Returns
MaterialObject3D — The material you have added.
clone()method 
public function clone():MaterialsList

Creates a copy of the materials list.

Returns
MaterialsList — A newly created materials list that contains a duplicate of each of its materials.
getMaterialByName()method 
public function getMaterialByName(name:String):MaterialObject3D

Returns the material that exists with the specified name.

Parameters
name:String — The name of the material to return.

Returns
MaterialObject3D — The material with the specified name.
removeMaterial()method 
public function removeMaterial(material:MaterialObject3D):MaterialObject3D

Removes the specified material from the materials list.

Parameters
material:MaterialObject3D — The material to remove.

Returns
MaterialObject3D — The material you have removed.
removeMaterialByName()method 
public function removeMaterialByName(name:String):MaterialObject3D

Removes the material that exists with the specified name.

The material object is garbage collected if no other references to the material exist.

The garbage collector is the process by which Flash Player reallocates unused memory space. When a variable or object is no longer actively referenced or stored somewhere, the garbage collector sweeps through and wipes out the memory space it used to occupy if no other references to it exist.

Parameters
name:String — The name of the material to remove.

Returns
MaterialObject3D — The material object that was removed.
toString()method 
public function toString():String

Returns a string with the names of the materials in the list.

Returns
String — A string.