| Package | graphics.display |
| Class | public class TimelineIterator |
| Inheritance | TimelineIterator Object |
| Implements | OrderedIterator |
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 ) ;
| Property | Defined 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 | ||
| Method | Defined 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 | ||
previous():*
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 | ||
| Constant | Defined By | ||
|---|---|---|---|
| DEFAULT_STEP : Number = 1 [static]
The minimum and default step value in all the TimelineIterator. | TimelineIterator | ||
| currentFrame | property |
currentFrame:int [read-only] The current frame of the iterator.
public function get currentFrame():int| currentLabel | property |
currentLabel:String [read-only] The current label in which the playhead is located in the timeline of the MovieClip instance.
public function get currentLabel():String| stepSize | property |
stepSize:uint [read-only] Returns the step size of this TimelineIterator.
public function get stepSize():uint| target | property |
target:MovieClip [read-only] Returns the target reference of this iterator.
public function get target():MovieClip| totalFrames | property |
totalFrames:Number [read-only] The current frame of the iterator.
public function get totalFrames():Number| TimelineIterator | () | Constructor |
public function TimelineIterator(target:MovieClip, framePosition:Number, stepSize:uint = 1)Creates a new TimelineIterator instance.
Parameterstarget: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).
|
ArgumentError — if the target argument of this constructor is null.
|
| hasNext | () | method |
public function hasNext():Boolean
Returns true if the iteration has more elements.
Boolean — true if the iterator has more elements.
|
| hasPrevious | () | method |
public function hasPrevious():BooleanChecks to see if there is a previous element that can be iterated to.
ReturnsBoolean — true 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():voidSeek 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* |
flash.errors:IllegalOperationError — the method remove() in this iterator is unsupported.
|
| reset | () | method |
public function reset():voidResets the key pointer of the iterator.
| seek | () | method |
public function seek(position:*):voidSeek the key pointer of the iterator.
Parameters
position:* |
| DEFAULT_STEP | Constant |
public static const DEFAULT_STEP:Number = 1The minimum and default step value in all the TimelineIterator.