org.osmf.traits

# SeekTrait - AS3 OSMF

Package | org.osmf.traits
Class | public class SeekTrait
Inheritance | SeekTrait MediaTraitBase EventDispatcher Object

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

SeekTrait defines the trait interface for media that can be instructed to jump to a position in time. It can also be used as the base class for a more specific SeekTrait subclass.

Use the `MediaElement.hasTrait(MediaTraitType.SEEK)` method to query whether a media element has a trait of this type. If `hasTrait(MediaTraitType.SEEK)` returns `true`, use the `MediaElement.getTrait(MediaTraitType.SEEK)` method to get an object that is guaranteed to be of this type.

Related API Elements

org.osmf.media.MediaElement

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | seeking : Boolean [read-only] Indicates whether the media is currently seeking. | SeekTrait
|  | traitType : String [read-only] The MediaTraitType for this trait. | MediaTraitBase

Protected Properties

| Property | Defined By
--- | --- | ---
|  | timeTrait : org.osmf.traits:TimeTrait The TimeTrait used by this SeekTrait. | SeekTrait

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | SeekTrait(timeTrait:org.osmf.traits:TimeTrait) Constructor. | SeekTrait
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | EventDispatcher
|  | canSeekTo(time:Number):Boolean Indicates whether the media is capable of seeking to the specified time. | SeekTrait
|  | dispatchEvent(event:Event):Boolean Dispatches an event into the event flow. | EventDispatcher
|  | dispose():void Disposes of any resources used by this trait. | MediaTraitBase
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | EventDispatcher
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | EventDispatcher
|  | seek(time:Number):void Instructs the media to jump to the specified time. | SeekTrait
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object
|  | willTrigger(type:String):Boolean Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | EventDispatcher

Protected Methods

| Method | Defined By
--- | --- | ---
|  | seekingChangeEnd(time:Number):void Called just after the seeking property has changed. | SeekTrait
|  | seekingChangeStart(newSeeking:Boolean, time:Number):void Called immediately before the seeking property is changed. | SeekTrait
|  | setSeeking(value:Boolean, time:Number):void Must be called by the implementing media on completing a seek. | SeekTrait

Events
Click for more information on events
Hide Inherited Events
Show Inherited Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | activate | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher
|  | deactivate | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher
|  | seekingChange | Dispatched when this trait begins or ends a seek operation. | SeekTrait

Property Detail

### seeking

property

`seeking:Boolean` [read-only]

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

Indicates whether the media is currently seeking.

Implementation
`public function get seeking():Boolean`

### timeTrait

property

`timeTrait:org.osmf.traits:TimeTrait`

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

The TimeTrait used by this SeekTrait.

Implementation
`protected function get timeTrait():org.osmf.traits:TimeTrait`
`protected function set timeTrait(value:org.osmf.traits:TimeTrait):void`
Constructor Detail

### SeekTrait

()
Constructor

`public function SeekTrait(timeTrait:org.osmf.traits:TimeTrait)`

Constructor.

Parameters

| `timeTrait:org.osmf.traits:TimeTrait`

Method Detail

### canSeekTo

()
method

`public function canSeekTo(time:Number):Boolean`

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

Indicates whether the media is capable of seeking to the specified time.

Parameters

| `time:Number` — Time to seek to in seconds.

Returns

| `Boolean` — Returns `true` if the media can seek to the specified time.

### seek

()
method

`public final function seek(time:Number):void`

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

Instructs the media to jump to the specified `time`. If a seek is attempted, dispatches a seekingChange event. If `time` is non numerical or negative, does not attempt to seek.

Parameters

| `time:Number` — Time to seek to in seconds.

### seekingChangeEnd

()
method

`protected function seekingChangeEnd(time:Number):void`

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

Called just after the `seeking` property has changed. Dispatches the change event.

Subclasses that override should call this method to dispatch the change event.

Parameters

| `time:Number` — New `time` value representing the time that the playhead seeked to.

### seekingChangeStart

()
method

`protected function seekingChangeStart(newSeeking:Boolean, time:Number):void`

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

Called immediately before the `seeking` property is changed.

Subclasses can override this method to communicate the change to the media.

Parameters

| `newSeeking:Boolean` — New `time` value representing the time that the playhead seeks to.
| `time:Number`

### setSeeking

()
method

`protected final function setSeeking(value:Boolean, time:Number):void`

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

Must be called by the implementing media on completing a seek. Calls the `seekingChangeStart()` and `seekingChangeEnd()` methods.

Parameters

| `value:Boolean` — New seeking value.
| `time:Number` — Position in seconds that the playhead was ultimately moved to.

Event Detail

### seekingChange

Event

Event Object Type: `org.osmf.events.SeekEvent`
property SeekEvent.type = `org.osmf.events.SeekEvent.SEEKING_CHANGE`

Language Version: | ActionScript 3.0

Product Version: | OSMF 1.0

Runtime Versions: | Flash Player 10, AIR 1.5

Dispatched when this trait begins or ends a seek operation.

The SeekEvent.SEEKING_CHANGE constant defines the value of the type property of the event object for a seekingChange event.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00