Bonjour,
J'essaye d'intégrer une barre de chargement à un jeu.
Mon souci est qu'elle ne commence pas à 0%.
J'ai constaté que plus j'ajoutais de clips à la bibliothèque, plus la barre commençait tard (ça peut aller jusque 30%).
Pourtant l'image 1, qui contient le code ci-dessous ne contient aucun élément sur la scène.
Voici le code :
Merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 stop(); var charg:TextField = new TextField(); addChild(charg); function progres (pEvt:ProgressEvent):void { var charge:Number = pEvt.bytesLoaded / pEvt.bytesTotal; var pct:int = charge* 100; charg.text="Chargement: "+ pct +"%"; } function complet (pEvt:Event):void { loaderInfo.removeEventListener(ProgressEvent.PROGRESS,progres); loaderInfo.removeEventListener(Event.COMPLETE,complet); gotoAndStop(2); } loaderInfo.addEventListener(ProgressEvent.PROGRESS,progres); loaderInfo.addEventListener(Event.COMPLETE,complet);
Franck.
Partager