Hi,
I have a probleme. I am using flash cs5
and I created a file called : animation.swf (his weight is 880 ko)
My goal is to create a loading barr for my file (animation.swf)
but when I want to import my file animation.swf in my library
it doesn t work.
Someone could explain me why it is not working?
thanks in advance
actionscript in an imported swf is not expected to work.
in addition, you should not be importing your swf, especially if you want to display its load progress. you should be loading animation.swf using the loader class:
var loader:Loader=new Loader();
loader.load(new URLRequest("animation.swf"));
addChild(loader);
thanks klad
I find this code but it is not working when I write : adresse.url = "animation.swf";
var adresse = new URLRequest();
var chargeur = new Loader();
var part_mc:Part_mc = new Part_mc;
var barre_mc:Barre_mc = new Barre_mc;
addChild(chargeur);
chargeur.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,mis eAjour);
chargeur.contentLoaderInfo.addEventListener(Event.COMPLETE,chargeTermi nee);
bt1.addEventListener(MouseEvent.MOUSE_DOWN,chargerImage)
function chargerImage (evt:MouseEvent) {
addChild(part_mc);
addChild(barre_mc);
part_mc.y = 420;
barre_mc.y = 400;
adresse.url = "animation.swf";
chargeur.load(adresse);
}
function miseAjour(evt:ProgressEvent) {
barre_mc.scaleX = evt.currentTarget.bytesLoaded/evt.currentTarget.bytesTotal;
var pourcentage =(evt.currentTarget.bytesLoaded/evt.currentTarget.bytesTotal)*100;
part_mc.etiquette.text = Math.round(pourcentage)+"%";
}
function chargeTerminee(evt:Event) {
removeChild(part_mc);
removeChild(barre_mc);
}
you should see an error if animation.swf is not in the correct directory. do you?
otherwise, use the trace() function to confirm chargerImage is being called. if it is, use a complete listener to confirm loading completes. if it does chargeur is probably covered by something you added to the display list after adding it. you can use addChild(chargeur) in your complete listener to remedy after confirming by adding a trace to animation.swf.
North America
Europe, Middle East and Africa
Asia Pacific