Question
MovieClipLoader Class Problem
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();
};
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();
};
