0 Replies Latest reply on Oct 29, 2010 5:27 AM by flexstone

    Update Progress Bar manually

    flexstone Level 1

      I have a custom event that I dispatch to update a progressBar which works nicely for downloading a file.

       

      I am trying to use the same technique to indicate progress of moving several directories from a DVD to the appStorageDirectory when the app is launched for the first time.

       

      I have the moving of files working fine but the progressBar though the event is dispatched does not update its display. Here is a snippet of my code loop which copies the directories....

       

       

                var incr:int = 1;
                var mx:int = copyRes.length;
                    
                     for each(var packageFolder:File in copyRes){
                         var dir:String = packageFolder.nativePath.toString().split(OSSep).pop()
                         this.dispatchEvent(new progressMadeEvent("incrementChange",incr,mx))
                         packageFolder.copyTo(appStore.resolvePath(dir))
                         incr++;
                     }

       

       

      Here is the update function in the titleWindow (PopUpWindow) that contains the progressBar

       

      private function updateProgress(event:progressMadeEvent):void{
                                             
                          cBar.setProgress(event.increment,event.max)
                          labelStr = int((event.increment/event.max)*100)+"% complete"
                          cBar.label = labelStr
                          trace(labelStr) // this trace displays the expected label but the label display does not change
                         
                          cBar.invalidateDisplayList()
                          cBar.invalidateProperties()
                                                                                    
                          if(event.increment==event.max && event.max>0){
                              thisApp.removeEventListener("incrementChange",updateProgress)                                               
                          }
                         
                      }

       

      What am I missing here ?