| Paquete | org.osmf.elements |
| Clase | public class DurationElement |
| Herencia | DurationElement ProxyElement MediaElement EventDispatcher Object |
| Versión del lenguaje: | ActionScript 3.0 |
| Versión de producto: | OSMF 1.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
The DurationElement class is especially useful for creating delays in the presentation of a media composition. For example, the following code presents a sequence of videos, separated from each other by five-second delays.
var sequence:SerialElement = new SerialElement();
sequence.addChild(new VideoElement(new URLResource("http://www.example.com/video1.flv")));
sequence.addChild(new DurationElement(5));
sequence.addChild(new VideoElement(new URLResource("http://www.example.com/ad.flv")));
sequence.addChild(new DurationElement(5));
sequence.addChild(new VideoElement(new URLResource("http://www.example.com/video2.flv")));
// Assign the SerialElement to the MediaPlayer.
player.media = sequence;
The following example presents a sequence of rotating banners. The delays separating the appearances of the banners are created with DurationElements. In addition, the images themselves are wrapped in DurationElements to enable them to support a duration.
// The first banner does not appear for five seconds.
// Each banner is shown for 20 seconds.
// There is a 15-second delay between images.
var bannerSequence:SerialElement = new SerialElement();
bannerSequence.addChild(new DurationElement(5));
bannerSequence.addChild(new DurationElement(20,new ImageElement(new URLResource("http://www.example.com/banner1.jpg")));
bannerSequence.addChild(new DurationElement(15));
bannerSequence.addChild(new DurationElement(20,new ImageElement(new URLResource("http://www.example.com/banner2.jpg")));
bannerSequence.addChild(new DurationElement(15));
bannerSequence.addChild(new DurationElement(20,new ImageElement(new URLResource("http://www.example.com/banner3.jpg")));
clipStartTime and clipEndTime properties.
Elementos de API relacionados
Propiedades públicas
Propiedades protegidas
Métodos públicos
| Método | Definido por | ||
|---|---|---|---|
Constructor. | DurationElement | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra un objeto de detector de eventos con un objeto EventDispatcher, de modo que el detector reciba la notificación de un evento. | EventDispatcher | |
![]() |
Adds a Metadata object to this MediaElement under the specified namespace URL. | MediaElement | |
![]() |
Distribuye un evento en el flujo del evento. | EventDispatcher | |
![]() |
Returns the Metadata object that is stored under this MediaElement with
the specified namespace URL. | MediaElement | |
![]() |
Returns the media trait of the specified type. | MediaElement | |
![]() |
Comprueba si el objeto EventDispatcher tiene detectores registrados para un tipo concreto de evento. | EventDispatcher | |
![]() |
Indica si un objeto tiene definida una propiedad especificada. | Object | |
![]() |
Determines whether this media element has a media trait of the
specified type. | MediaElement | |
![]() |
Indica si hay una instancia de la clase Object en la cadena de prototipo del objeto especificado como parámetro. | Object | |
![]() |
Indica si existe la propiedad especificada y si es enumerable. | Object | |
![]() |
Elimina un detector del objeto EventDispatcher. | EventDispatcher | |
![]() |
Removes the Metadata object that was stored under this MediaElement with
the specified namespace URL. | MediaElement | |
![]() |
Establece la disponibilidad de una propiedad dinámica para operaciones de bucle. | Object | |
![]() |
Devuelve la representación de cadena de este objeto, con formato según las convenciones específicas de configuración regional. | Object | |
![]() |
Devuelve la representación de cadena del objeto especificado. | Object | |
![]() |
Devuelve el valor simple del objeto especificado. | Object | |
![]() |
Comprueba si hay registrado un detector de eventos con este objeto EventDispatcher o con cualquiera de sus ascendientes para el tipo de evento concreto. | EventDispatcher | |
Métodos protegidos
Eventos
Información sobre constructores
DurationElement | () | Información sobre |
public function DurationElement(duration:Number, mediaElement:MediaElement = null)| Versión del lenguaje: | ActionScript 3.0 |
| Versión de producto: | OSMF 1.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Constructor.
Parámetrosduration:Number — Duration of the DurationElement's TimeTrait, in seconds.
| |
mediaElement:MediaElement (default = null) — Optional element to be wrapped by this DurationElement.
|
Ejemplos Cómo utilizar este ejemplo
DurationElementExample.as
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import org.osmf.elements.BeaconElement;
import org.osmf.elements.DurationElement;
import org.osmf.elements.ImageElement;
import org.osmf.elements.VideoElement;
import org.osmf.media.MediaPlayer;
import org.osmf.media.MediaPlayerSprite;
import org.osmf.media.URLResource;
public class DurationElementExample extends Sprite
{
public function DurationElementExample()
{
super();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var mediaPlayerSprite:MediaPlayerSprite = new MediaPlayerSprite();
var imageElement:ImageElement = new ImageElement();
imageElement.resource = new URLResource("http://mediapm.edgesuite.net/strobe/content/test/train.jpg");
// Shows the image for 10 seconds.
var durationElement:DurationElement = new DurationElement(10, imageElement);
addChild(mediaPlayerSprite);
mediaPlayerSprite.media = durationElement;
}
}
}
Tue Jun 12 2018, 02:12 PM Z
Ocultar propiedades públicas heredadas
Mostrar propiedades públicas heredadas