Solved

Assets appear before movie is loaded

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need to have horizontal scrollbar in AdvancedDatagrid next to the freezed columns. 4 373
HTML 5 or Flash 7 489
Flash player plugin 13 7 339
Crash with shockwave flash 8 252
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…

831 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