Packageimpression.persistence
Classpublic class StoryboardCollection
InheritanceStoryboardCollection Inheritance Object

The StoryboardCollection object is an unordered list of Storyboard objects.

Storyboards are stored as an associative array (hash table), with the storyboards' sbid property acting as the key.



Public Properties
 PropertyDefined By
  length : Number
[read-only] The number of items in the collection.
StoryboardCollection
Public Methods
 MethodDefined By
  
Creates a new instance of the StoryboardCollection class.
StoryboardCollection
  
add(sb:Storyboard):void
Adds an item to the collection.
StoryboardCollection
  
clear():void
Removes all items from the collection.
StoryboardCollection
  
clone(deep:Boolean = true):StoryboardCollection
Returns a copy of the object.
StoryboardCollection
  
contains(item:*):Boolean
Returns a value indicating whether or not an item exists in the collection.
StoryboardCollection
  
every(callback:Function, thisObject:* = null):Boolean
Executes a test function on each item in the collection until an item is reached that returns false for the specified function.
StoryboardCollection
  
filter(callback:Function, thisObject:* = null):StoryboardCollection
Executes a test function on each item in the collection and constructs a new StoryboardCollection for all items that return true for the specified function.
StoryboardCollection
  
forEach(callback:Function, thisObject:* = null):void
Executes a function on each item in the collection.
StoryboardCollection
  
[static] Returns a new instance of the StoryboardCollection class containing the data from an array.
StoryboardCollection
  
[static] Returns a new instance of the StoryboardCollection class based on the data contained in the XML object.
StoryboardCollection
  
item(identifier:*):Storyboard
Returns an item from the collection.
StoryboardCollection
  
Removes an item from the collection.
StoryboardCollection
  
some(callback:Function, thisObject:* = null):Boolean
Executes a test function on each item in the collection until an item is reached that returns true for the specified function.
StoryboardCollection
  
toArray(map:LessonMap = null, includeAll:Boolean = true):Array
Returns an array containing references to all items in the collection.
StoryboardCollection
  
toObject():Object
Returns an Object containing references to all items in the collection.
StoryboardCollection
  
toString():String
Returns the string representation of the specified object.
StoryboardCollection
  
toXML():XML
Returns an Impression-format XML object containing all the data from the object.
StoryboardCollection
Property Detail
lengthproperty
length:Number  [read-only]

The number of items in the collection.


Implementation
    public function get length():Number
Constructor Detail
StoryboardCollection()Constructor
public function StoryboardCollection()

Creates a new instance of the StoryboardCollection class.

Method Detail
add()method
public function add(sb:Storyboard):void

Adds an item to the collection.

If a Storyboard object is already in the collection with the same sbid property value, the new value replaces it. If sb is null, invoking this method has no effect.

Parameters

sb:Storyboard — A Storyboard object containing the storyboard to add to the collection.

clear()method 
public function clear():void

Removes all items from the collection.

clone()method 
public function clone(deep:Boolean = true):StoryboardCollection

Returns a copy of the object.

If the deep parameter is true, a copy of each contained Storyboard object (created using the Storyboard object's clone method) is added to the copy. If the deep parameter is false, a reference to each contained Storyboard object is added to the copy.

Note that copied Storyboard objects have the same sbid value as the originals.

Parameters

deep:Boolean (default = true) — Specifies how the contained Storyboard objects should be added to the copy.

Returns
StoryboardCollection — A copy of the object.

See also

contains()method 
public function contains(item:*):Boolean

Returns a value indicating whether or not an item exists in the collection.

Parameters

item:* — An expression specifying the item to search for. item can be one of the following types:
  • String. Method searches for a storyboard whose sbid property value matches the parameter.
  • Storyboard. Method searches for a storyboard whose sbid property value matches the sbid value of the parameter.
  • [other types]. Method returns true if a call to the item method with the passed parameter does not return null.

Returns
Booleantrue if the item was found in the collection and false otherwise.
every()method 
public function every(callback:Function, thisObject:* = null):Boolean

Executes a test function on each item in the collection until an item is reached that returns false for the specified function. You use this method to determine whether all items in the collection meet a criterion.

For this method, the second parameter, thisObject, must be null if the first parameter, callback, is a method closure.

This method iterates through each item in the collection, executing the statement

until the result of the call returns false.

The callback function will be invoked with one argument, the value of an item (a Storyboard object):

Parameters

callback:Function — The function to run on each item in the collection. This function can contain a simple comparison or a more complex operation.
 
thisObject:* (default = null) — An object to use as this for the function.

Returns
Booleantrue if all items in the collection return true for the specified function; otherwise, false.

See also

Flash.Array.every()
filter()method 
public function filter(callback:Function, thisObject:* = null):StoryboardCollection

Executes a test function on each item in the collection and constructs a new StoryboardCollection for all items that return true for the specified function. If an item returns false, it is not included in the new collection.

For this method, the second parameter, thisObject, must be null if the first parameter, callback, is a method closure.

This method iterates through each item in the collection, executing the statement

and appending the value of item to the new collection if the function returns true.

The callback function will be invoked with one argument, the value of an item (a Storyboard object):

Parameters

callback:Function — The function to run on each item in the collection. This function can contain a simple comparison or a more complex operation.
 
thisObject:* (default = null) — An object to use as this for the function.

Returns
StoryboardCollection — A new StoryboardCollection that contains all the items from the original collection that returned true.

See also

Flash.Array.filter()
forEach()method 
public function forEach(callback:Function, thisObject:* = null):void

Executes a function on each item in the collection.

For this method, the second parameter, thisObject, must be null if the first parameter, callback, is a method closure.

This method iterates through each item in the collection, executing the statement

The callback function will be invoked with one argument, the value of an item (a Storyboard object):

Parameters

callback:Function — The function to run on each item in the collection. This function can contain a simple comparison or a more complex operation.
 
thisObject:* (default = null) — An object to use as this for the function.

See also

Flash.Array.forEach()
fromStoryboardArray()method 
public static function fromStoryboardArray(sbArray:Array):StoryboardCollection

Returns a new instance of the StoryboardCollection class containing the data from an array.

If sbArray is null or its length property is 0, then an empty StoryboardCollection object is returned.

Parameters

sbArray:Array — The array containing the storyboards to be inserted into the collection.

Returns
StoryboardCollection — A StoryboardCollection object containing the storyboards from sbArray.
fromXML()method 
public static function fromXML(source:XML):StoryboardCollection

Returns a new instance of the StoryboardCollection class based on the data contained in the XML object.

If source is null, an empty StoryboardCollection object is returned. If the source.name property is not "storyboards", an error is thrown.

The XML format of a StoryboardCollection object is:

Where [storyboard xml] is a valid Storyboard XML property value.

This method iterates through the direct children of the node. If any child node's name property is "storyboard", a Storyboard object (created by invoking the Storyboard.fromXML class constructor with the child node) is added to the collection.

Parameters

source:XML — The object containing the data to use.

Returns
StoryboardCollection — A StoryboardCollection object containing the data from the source XML object.

Throws
ArgumentError node — is not a <storyboards> element (ArgumentError).

See also

item()method 
public function item(identifier:*):Storyboard

Returns an item from the collection.

If no object specified by the identifier parameter is in the collection, null is returned.

Parameters

identifier:* — An expression specifying the unique item to return. identifier can be one of the following types:
  • String. Method searches for a storyboard whose sbid property value matches the parameter.
  • [numeric types]. Method searches for a storyboard whose shortID property value matches the parameter.

Returns
Storyboard — A Storyboard object specified by the identifier.
remove()method 
public function remove(sb:Storyboard):void

Removes an item from the collection.

If sb is null or if the sb.sbid property was not found in the collection, invoking this method has no effect.

This method removes the item indexed by the sb parameter's sbid property value, even if the parameter is not the item stored in the collection. Exercies care when using this method.

Parameters

sb:Storyboard — A Storyboard object specifying the storyboard to remove from the collection.

some()method 
public function some(callback:Function, thisObject:* = null):Boolean

Executes a test function on each item in the collection until an item is reached that returns true for the specified function. You use this method to determine whether all items in the collection meet a criterion.

For this method, the second parameter, thisObject, must be null if the first parameter, callback, is a method closure.

This method iterates through each item in the collection, executing the statement

until the result of the call returns false.

The callback function will be invoked with one argument, the value of an item (a Storyboard object):

Parameters

callback:Function — The function to run on each item in the collection. This function can contain a simple comparison or a more complex operation.
 
thisObject:* (default = null) — An object to use as this for the function.

Returns
Booleantrue if any items in the collection return true for the specified function; otherwise, false.

See also

Flash.Array.some()
toArray()method 
public function toArray(map:LessonMap = null, includeAll:Boolean = true):Array

Returns an array containing references to all items in the collection.

If map is null, an unordered Array of all the storyboards in the collection will be returned. If map is not null, an Array of storyboards in the collection ordered by their linear reference in map will be returned.

If includeAll is true, the returned Array will also contain the storyboards in the collection that are not referenced by map, appended to the Array after the referenced items, but in no defined order.

The Array returned contains references to the Storyboard objects. If you need copies of all storyboards in the collection, you can use the clone method on each item in the array.

Parameters

map:LessonMap (default = null) — A LessonMap object specifying the items and the order in which they should be placed in the returned array.
 
includeAll:Boolean (default = true) — Indicates whether or not items not referenced in map should be appended to the array.

Returns
Array — An Array containing storyboards from the collection.
toObject()method 
public function toObject():Object

Returns an Object containing references to all items in the collection.

Property values are stored as dynamic properties (keyed on each storyboard's sbid property value) within the object.

The Object returned contains references to the Storyboard objects. If you need copies of all storyboards in the collection, you can use the clone method on each item in the object.

Returns
Object — An Object containing all of the storyboards in the collection.
toString()method 
public function toString():String

Returns the string representation of the specified object.

Returns
String — The string representation of the specified object.
toXML()method 
public function toXML():XML

Returns an Impression-format XML object containing all the data from the object.

The shortid attributes for each <storyboard> element are regenerated by this method.

Returns
XML — An XML object containing all the data from the object.

See also