Notice: Undefined index: comp_id in /var/www/vhosts/afcomponents.com/httpdocs/system/lib/objects/tutorials.inc.php on line 112

Notice: Undefined index: comp_id in /var/www/vhosts/afcomponents.com/httpdocs/system/modules/tutorials.mod.php on line 31

Notice: Undefined index: section_title in /var/www/vhosts/afcomponents.com/httpdocs/system/modules/tutorials.mod.php on line 32

Notice: Undefined index: section_tag in /var/www/vhosts/afcomponents.com/httpdocs/system/modules/tutorials.mod.php on line 32
Advanced Flash Components
Advanced Flash Components
Search!
Search!
Home >  Tutorials >   >  Building a Buffer Video: FLV Player
Building a Buffer Video: FLV Player
Updated: Jul 30, 2008   Views: 9602  
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});
Component Info