Warning: ob_start() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in /home/vaishali/public_html/wp-includes/functions.php on line 408
Creativity Rules » Blog Archive » FLVPlayback FLV Preloader

FLVPlayback FLV Preloader

Here’s a way to Preload flv files before you play them in FLVPlayback component.

import mx.video.*;

var listenerObject:Object = new Object();

my_FLVPlybk.progressInterval = 001;
my_FLVPlybk.autoPlay = false;

listenerObject.progress = function(eventObject:Object) :Void {

var perc = Math.floor(eventObject.bytesLoaded * 100 / eventObject.bytesTotal);
this.loading_mc.load_txt.text = perc + "% loaded.";

if(perc == 100)
my_FLVPlybk.play();

}

my_FLVPlybk.addEventListener("progress", listenerObject);
my_FLVPlybk.load("yourflv.flv");

You can hide the player while its getting downloaded and show it when its fully downloaded. Make sure to set the autoplay option to false.

Happy coding :)

3 Responses to “FLVPlayback FLV Preloader”

  1. DeepBlock Says:

    Would that work with action script 3 flash cs3…if it supposed to, this is the error I’m getting when I use the code.

    1046: Type was not found or was not a compile-time constant: Void.

  2. Vaishali Says:

    Not sure regarding AS3. The code provided above is for AS2. Probably you can remove the Void return type for AS3.

  3. Michax Says:

    Thank’s a lot. I applied your code successfully to my project ! I tried before on my own to figure out somethink like your code .. but i fuc.. up :)

Leave a Reply