Solved

Assets appear before movie is loaded

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

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 …
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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): …
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.

803 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