FLVPlayback load 50% then play

Hello guys,

My 1st post here :slight_smile:

I’m trying to publish a video in a way that it would only play after 50% is loaded.

I’m using CS3 with AS 2.0.

Here is the code that I found online and adapted:


import mx.video.*;
var listenerObject:Object = new Object();

listenerObject.ready = function(eventObject:Object):Void {
    my_FLVPlybk.pause();
    trace("State is " + eventObject.state);
    // display the no. of bytes loaded at this point
    trace("Bytes loaded: " + my_FLVPlybk.bytesLoaded + " Bytes Total / 2: " + (my_FLVPlybk.bytesTotal / 2));
    while(my_FLVPlybk.bytesLoaded < (my_FLVPlybk.bytesTotal / 2)){
    }
    trace("Loaded!");
    my_FLVPlybk.play();
};
my_FLVPlybk.contentPath = "teste.flv";
my_FLVPlybk.addEventListener("ready", listenerObject);

There is no output error when I test locally but with the online test my browser tells me that the script is taking to long to bla bla bla…

I’m new to AS so be gentle :stuck_out_tongue:

Thank you all!

Anthon.