Link to home
Start Free TrialLog in
Avatar of Rouchie
RouchieFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Assets appear before movie is loaded

I am loading a movie into an empty placeholder using the MovieClipLoader object.  Currently I see that if the file is large, certain assets within it (video etc) start to appear within the placeholder before the entire file is loaded.  Therefore I want to hide the placeholder until the movie is fully loaded into it.

My code is below, except that something is wrong because I am still seeing the movie's assets appearing within the placeholder, when surely the placeholder shouldn't even be visible!  Can anyone spot my mistake?!?

var my_mcl:MovieClipLoader = new MovieClipLoader();
var my_listener:Object = new Object();

my_listener.onLoadStart = function(mc) {
      preloaderStatusText._visible = true;
      preloader._visible = true;
      preloader.preloadbar._xscale = 0;
};
my_listener.onLoadProgress=function(mc,loadedBytes,totalBytes) {
      preloaderStatusText.text = "Loading content (" + Math.round(loadedBytes/totalBytes * 100) + "%)";
      preloader.preloadbar._xscale = Math.round(100*loadedBytes/totalBytes);
};
my_listener.onLoadComplete=function(mc)      {
      this.placeHolder._visible = true;
      preloaderStatusText._visible = false;
      preloader._visible = false;
};
my_listener.onLoadInit=function(mc) {
      placeHolder._width = borderOutline._width;
      placeHolder._height = borderOutline._width;
};
my_mcl.addListener(my_listener);

this.placeHolder._visible = false;
my_mcl.loadClip(fileURL, this.placeHolder);
ASKER CERTIFIED SOLUTION
Avatar of Aneesh Chopra
Aneesh Chopra
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rouchie

ASKER

Hi Aneesh

That's absolutely perfect - many thanks.

-- R