Advanced Flash Components
Search!
Search!
Home >  Tutorials >  FLV Player (AS 3.0) Basic Skins >  Building a Buffer Video: FLV Player
Building a Buffer Video: FLV Player
Updated: Jul 30, 2008   Views: 1746  
Description: In this tutorial we will go through the steps on how to build a buffer pre-loader video that plays until the initial video starts.
Completed Project



Complete Code:


import fl.video.VideoEvent;
import fl.transitions.*;
import fl.transitions.easing.*;

myPlayer.bufferTime = 2;
mcBufferingIndicator.visible = true;

function onPlayerBuffered(event:VideoEvent) {
    TransitionManager.start(mcBufferingIndicator, {type:Fade, direction:Transition.OUT, duration:0.5, easing:Strong.easeOut});
}
myPlayer.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, onPlayerBuffered);


Creating a Pre-Loader:
This video can be any animated movie clip.

Entered State EventListener
We will need a eventListener for when the player first enters the playing state. The buffer is set to show when the player is opened. The amount of buffertime is also set here.(amount of time it buffers before video is played)

myPlayer.bufferTime = 2;
mcBufferingIndicator.visible = true;

import fl.video.VideoEvent;
function onPlayerBuffered(event:VideoEvent) {

}
myPlayer.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, onPlayerBuffered);


Buffer Transitions
To make this buffer video look clean we have imported a couple transition classes and set the buffer video to  fade away when video starts playing.

TransitionManager.start(mcBufferingIndicator, {type:Fade, direction:Transition.OUT, duration:0.5, easing:Strong.easeOut});