Comment à chaque chargement de mon graphique qui fait appel à un service web initialisé une progressBar ?
1. j'utilise l'attribut sur le composant ColumnChart : initialize = initMyChart();
2. intégration de la progressBar en MXML en mode "manual"
3. Code AS de la fonction initMyChart :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
private function initMyChart():void{
myChart.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
myChart.addEventListener(Event.COMPLETE,onLoadComplete);
}
private function onLoadProgress(e:ProgressEvent):void{
var pourcent : Number = e.bytesLoaded/e.bytesTotal * 100;
myProgress.setProgress(pourcent,100);
myProgress.label = "Chargement " + Math.round(pourcent) + " %";
}
private function onLoadComplete(e:*):void{
myProgress.visible = false;
} |
Je n'arrive pas à récupérer l'évenement sur le graphique via :
myChart.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
Des idées ?
Partager