This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > November 2006 > MovieClipLoader Problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author MovieClipLoader Problem
Essam Maccar

2006-11-05, 10:33 pm

Dear all
I have a movie wher in the first frame i need to load a jpeg that will act
like the background of the movie so it take time more than the content and i
decided to load it first to an emptymovieclip on the stage first and if it
is loaded then it will continue playing my movie as the rest of contents
will show.

and here is how i manage things but it is not working so i am waiting for
any suggesstions
i need to show a loader bar while loading this bg and when finish
_root.gotoAndPlay (2);

the code i use is as following providing that i have an empty MC called
"my_mc"on the stage
and there is no loader showing or anything and it loads the pic then stops
and not continue to frame 2.


var myloader:MovieClipLoader=new MovieClipLoader();
myloader.loadClip("bg.jpg",this.my_mc);
var myListener:Object = new Object();
myloader.addListener(myListener);
myListener.onLoadProgress=function(target_mc:MovieClip,bytesLoaded:Number,bytesTotal:Number)
{
this.createEmptyMovieClip("progressBar_mc", 0);
progressBar_mc.createEmptyMovieClip("bar_mc", 1);
progressBar_mc.createEmptyMovieClip("stroke_mc", 2);
with (progressBar_mc.stroke_mc) {
lineStyle(0, 0x000000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
}
with (progressBar_mc.bar_mc) {
beginFill(0xFF0000, 100);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
endFill();
_xscale = 0;
}
progressBar_mc._x = this.width /2;
progressBar_mc._y = this.height/2;
}
myListener.onLoadStart = function(target_mc:MovieClip) {
progressBar_mc.bar_mc._xscale = 0;
};
myListener.onLoadProgress = function(target_mc:MovieClip,
bytesLoaded:Number, bytesTotal:Number) {
progressBar_mc.bar_mc._xscale = Math.round(bytesLoaded/bytesTotal*100);
if(bytesLoaded == bytesTotal){
this.gotoAndPlay(2);
}

};
myListener.onLoadComplete = function(target_mc:MovieClip) {
progressBar_mc.removeMovieClip();

};




droopy.ro

2006-11-05, 10:33 pm

hello,
the point is that flash won't start playin' until the first frame is fully
loaded. so the preloader doesn't work because it loads the picture before the
preloader will apear. you have to move your picture to frame 2, and the rest of
the content to frame 3. it should work(i haven't looked at the code, but unless
thre is a problem there should work)..

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews