Packageasgard.display
Classpublic class TimelineIterator
InheritanceTimelineIterator Inheritance CoreObject
ImplementsOrderedIterator

This iterator control the timeline in a MovieClip target.

Example :With container a MovieClip reference added in the stage of the application, this MovieClip contains 10 frames

     import asgard.display.TimelineIterator ;
     
     var it:TimelineIterator = new TimelineIterator( container , 2 ) ;
     
     trace( "timeline current frame : " + it.currentFrame ) ;
     trace( "timeline total frames  : " + it.totalFrames ) ;
     
     var keyDown:Function = function( e:KeyboardEvent ):void
     {
         var code:uint = e.keyCode ;
         switch(code)
         {
             case Keyboard.LEFT :
             {
                 if ( it.hasPrevious() )
                 {
                     it.previous() ;
                 }
                 else
                 {
                     it.last() ;
                 }
                 break ;
             }
             case Keyboard.RIGHT :
             {
                 if ( it.hasNext() )
                 {
                     it.next() ;
                 }
                 else
                 {
                     it.reset() ;
                 }
                 break ;
             }
         }
         trace( "timeline : " + it.currentFrame + " | " + it.totalFrames + " | frame label : " + it.currentLabel ) ;
     }
     
     stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
     



Public Properties
 PropertyDefined by
  currentFrame : int
[read-only] (read-only) The current frame of the iterator.
TimelineIterator
  currentLabel : String
[read-only] (read-only) The current label in which the playhead is located in the timeline of the MovieClip instance.
TimelineIterator
  target : MovieClip
[read-only] (read-only) Returns the target reference of this iterator.
TimelineIterator
  totalFrames : Number
[read-only] (read-only) The current frame of the iterator.
TimelineIterator
Public Methods
 MethodDefined by
  
TimelineIterator(target:MovieClip, framePosition:Number, stepSize:uint = 1)
Creates a new TimelineIterator instance.
TimelineIterator
 Inherited
Returns the internal ILogger reference of this ILogable object.
CoreObject
  
getStepSize():Number
Returns the step size of this PageByPageIterator.
TimelineIterator
 Inherited
hashCode():uint
Returns a hashcode value for the object.
CoreObject
  
hasNext():Boolean
Returns true if the iteration has more elements.
TimelineIterator
  
hasPrevious():Boolean
Checks to see if there is a previous element that can be iterated to.
TimelineIterator
  
key():*
Returns the current page number.
TimelineIterator
  
last():void
Seek the key pointer of the iterator over the last frame of the timeline.
TimelineIterator
  
next():*
Returns the next Array page of elements or the next element in the Array if the getStepSize() value is 1.
TimelineIterator
  
Returns the previous Array page of elements or the previous element in the Array if the getStepSize() value is 1.
TimelineIterator
  
remove():*
Unsupported operation in this iterator.
TimelineIterator
  
reset():void
Resets the key pointer of the iterator.
TimelineIterator
  
seek(position:*):void
Seek the key pointer of the iterator.
TimelineIterator
 Inherited
setLogger(log:ILogger = null):void
Sets the internal ILogger reference of this ILogable object.
CoreObject
 Inherited
toSource(indent:int = 0):String
Returns the string representation the source code of the object.
CoreObject
 Inherited
toString():String
Returns the string representation of this instance.
CoreObject
Public Constants
 ConstantDefined by
  DEFAULT_STEP : Number = 1
[static] The default step value in all the PageByPageIterators.
TimelineIterator
Property detail
currentFrameproperty
currentFrame:int  [read-only]

(read-only) The current frame of the iterator.

Implementation
    public function get currentFrame():int
currentLabelproperty 
currentLabel:String  [read-only]

(read-only) The current label in which the playhead is located in the timeline of the MovieClip instance.

Implementation
    public function get currentLabel():String
targetproperty 
target:MovieClip  [read-only]

(read-only) Returns the target reference of this iterator.

Implementation
    public function get target():MovieClip
totalFramesproperty 
totalFrames:Number  [read-only]

(read-only) The current frame of the iterator.

Implementation
    public function get totalFrames():Number
Constructor detail
TimelineIterator()constructor
public function TimelineIterator(target:MovieClip, framePosition:Number, stepSize:uint = 1)

Creates a new TimelineIterator instance.

Parameters
target:MovieClip — The MovieClip reference of this iterator.
 
framePosition:Number — the default framePosition of the specified MovieClip target (default frame 1).
 
stepSize:uint (default = 1) — (optional) the step between two frames returns by the iterator (default 1).

Throws
— if the target argument of this constructor is empty.
Method detail
getStepSize()method
public function getStepSize():Number

Returns the step size of this PageByPageIterator.

Returns
Number — the step size of this PageByPageIterator.
hasNext()method 
public function hasNext():Boolean

Returns true if the iteration has more elements.

Returns
Booleantrue if the iterator has more elements.
hasPrevious()method 
public function hasPrevious():Boolean

Checks to see if there is a previous element that can be iterated to.

Returns
Booleantrue if the iterator has more elements.
key()method 
public function key():*

Returns the current page number.

Returns
* — the current page number.
last()method 
public function last():void

Seek the key pointer of the iterator over the last frame of the timeline.

next()method 
public function next():*

Returns the next Array page of elements or the next element in the Array if the getStepSize() value is 1.

Returns
* — the next Array page of elements or the next element in the Array if the getStepSize() value is 1.
previous()method 
public function previous():*

Returns the previous Array page of elements or the previous element in the Array if the getStepSize() value is 1.

Returns
* — the previous element from the collection.
remove()method 
public function remove():*

Unsupported operation in this iterator.

Returns
*

Throws
— the method remove() in this iterator is unsupported.
reset()method 
public function reset():void

Resets the key pointer of the iterator.

seek()method 
public function seek(position:*):void

Seek the key pointer of the iterator.

Parameters
position:*
Constant detail
DEFAULT_STEPconstant
public static const DEFAULT_STEP:Number = 1

The default step value in all the PageByPageIterators.