Packagegraphics.display
Classpublic class TimelineIterator
InheritanceTimelineIterator Inheritance Object
Implements OrderedIterator

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 graphics.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] The current frame of the iterator.
TimelineIterator
  currentLabel : String
[read-only] The current label in which the playhead is located in the timeline of the MovieClip instance.
TimelineIterator
  stepSize : uint
[read-only] Returns the step size of this TimelineIterator.
TimelineIterator
  target : MovieClip
[read-only] Returns the target reference of this iterator.
TimelineIterator
  totalFrames : Number
[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
  
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
Public Constants
 ConstantDefined By
  DEFAULT_STEP : Number = 1
[static] The minimum and default step value in all the TimelineIterator.
TimelineIterator
Property Detail
currentFrameproperty
currentFrame:int  [read-only]

The current frame of the iterator.


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

The current label in which the playhead is located in the timeline of the MovieClip instance.


Implementation
    public function get currentLabel():String
stepSizeproperty 
stepSize:uint  [read-only]

Returns the step size of this TimelineIterator.


Implementation
    public function get stepSize():uint
targetproperty 
target:MovieClip  [read-only]

Returns the target reference of this iterator.


Implementation
    public function get target():MovieClip
totalFramesproperty 
totalFrames:Number  [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 (default = NaN) — 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 and minimum value is 1).

Throws
ArgumentError — if the target argument of this constructor is null.
Method Detail
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
flash.errors:IllegalOperationError — 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 minimum and default step value in all the TimelineIterator.