PDA

View Full Version : The progress bar "not going invisible after load"


colorada
05-28-2006, 05:28 AM
Would someone be so kind and look at my code to see what in the world I am doing wrong? I know it is something simple.

Everything seems to work fine I just can't get my progressbar to vanish after load. This should be very simple to do if you want to play along at home.

Opena new document and load a progressbar as well as a loader component into your library.

Paste in the code.

you may have to make _width & _height adjustments, but other than that it works, except for the "progressbar" not dissapearing.


//////AS//////
this.createClassObject(mx.controls.Loader, "my_ldr", 10);
this.createClassObject(mx.controls.ProgressBar, "my_pb", 11);

my_pb.source ="my_ldr";
my_pb.mode = "polled";
my_ldr.autoLoad = true;
my_pb.move(305, 235);
my_ldr.contentPath = "http://www.helpexamples.com/flash/images/image3.jpg";

var content_mc:MovieClip = my_ldr.content;
var loadTest:Object = new Object();
var loadTest:Object = new Object();

loadTest.complete = function() {
//Set Properties
content_mc._width = 550;
content_mc._height = 320;
content_mc._x = 185;
content_mc._y = 100;
//trace(content_mc._width);
}

loadTest.progress = function() {
my_pb.setProgress(my_ldr.bytesLoaded, my_ldr.bytesTotal); //Show progress
}

//listeners
loadTest.onLoadComplete = function(content_mc:MovieClip) {
my_pb._visible = false;
};
my_ldr.addEventListener("complete", loadTest);

colorada
05-31-2006, 01:06 AM
Any Thoughts or Ideas?:confused:

BusterKeatonFan
06-12-2006, 10:37 PM
When I used the loader component combined with the progressbar component
the following worked for me:

I placed both the loader and the progressbar components on the scene and gave them instance names of myLoader and myProgressbar
in the parameters tab:
I set the contentpath for the loader to my .swf (jpeg in your case) file
and the source for the progressbar as: myLoader

then in my actions layer I used the code:

myProgressBar.complete = function () {
myProgressBar._visible = false;
};


not sure how relevant this is to your code...
I'm kinda new at this
I also tried making a listener object but couldn't get it to work right
but this technique worked for me...

you could probably plug in:

my_pb.complete = function () {
my_pb._visible = false;
};

instead of the listener object and it should work...

hope this is helpful.