Solved

Assets appear before movie is loaded

Posted on 2007-04-05
2
189 Views
Last Modified: 2010-04-03
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);
0
Comment
Question by:Rouchie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 18856792
stop and hide loading movie in "onLoadStart" and play and unhide in "onLoadInit"

here is the udpated code:
==========
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;
      mc._visible = false;
      mc.stop();
};
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)
{
      mc._visible = true;
      mc.play();
      placeHolder._width = borderOutline._width;
      placeHolder._height = borderOutline._width;
};
my_mcl.addListener(my_listener);
this.placeHolder._visible = false;
my_mcl.loadClip(fileURL, this.placeHolder);

===========


it should work

- Aneesh Chopra
 
0
 
LVL 25

Author Comment

by:Rouchie
ID: 18857042
Hi Aneesh

That's absolutely perfect - many thanks.

-- R
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question