Solved

Assets appear before movie is loaded

Posted on 2007-04-05
2
176 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now