| Pacchetto | org.osmf.elements |
| Classe | public class DurationElement |
| Ereditarietà | DurationElement ProxyElement MediaElement EventDispatcher Object |
| Versione linguaggio: | ActionScript 3.0 |
| Versione prodotto: | OSMF 1.0 |
| Versioni runtime: | 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.
Elementi API correlati
Proprietà pubbliche
Proprietà protette
Metodi pubblici
| Metodo | Definito da | ||
|---|---|---|---|
Constructor. | DurationElement | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra un oggetto listener di eventi con un oggetto EventDispatcher, in modo che il listener riceva la notifica di un evento. | EventDispatcher | |
![]() |
Adds a Metadata object to this MediaElement under the specified namespace URL. | MediaElement | |
![]() |
Invia un evento nel flusso di eventi. | 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 | |
![]() |
Verifica se per l'oggetto EventDispatcher sono presenti listener registrati per un tipo specifico di evento. | EventDispatcher | |
![]() |
Indica se per un oggetto è definita una proprietà specifica. | Object | |
![]() |
Determines whether this media element has a media trait of the
specified type. | MediaElement | |
![]() |
Indica se un'istanza della classe Object si trova nella catena di prototipi dell'oggetto specificato come parametro. | Object | |
![]() |
Indica se la proprietà specificata esiste ed è enumerabile. | Object | |
![]() |
Rimuove un listener dall'oggetto EventDispatcher. | EventDispatcher | |
![]() |
Removes the Metadata object that was stored under this MediaElement with
the specified namespace URL. | MediaElement | |
![]() |
Imposta la disponibilità di una proprietà dinamica per le operazioni cicliche. | Object | |
![]() |
Restituisce la rappresentazione in formato stringa di questo oggetto, formattato in base alle convenzioni specifiche per le versioni localizzate. | Object | |
![]() |
Restituisce la rappresentazione in formato stringa dell'oggetto specificato. | Object | |
![]() |
Restituisce il valore di base dell'oggetto specificato. | Object | |
![]() |
Verifica se un listener di eventi è registrato con questo oggetto EventDispatcher o qualsiasi suo antenato per il tipo di evento specificato. | EventDispatcher | |
Metodi protetti
Eventi
Descrizione della funzione di costruzione
DurationElement | () | Funzione di costruzione |
public function DurationElement(duration:Number, mediaElement:MediaElement = null)| Versione linguaggio: | ActionScript 3.0 |
| Versione prodotto: | OSMF 1.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5 |
Constructor.
Parametriduration:Number — Duration of the DurationElement's TimeTrait, in seconds.
| |
mediaElement:MediaElement (default = null) — Optional element to be wrapped by this DurationElement.
|
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:44 PM Z
Nascondi proprietà pubbliche ereditate
Mostra proprietà pubbliche ereditate