There is a loop in your code but where actually are you creating instances of Canvas and ProgressBar with different names? As per your code there will be always one instance of your ProgressBar and also I could not figure out from where you have got the reference of "can1"
On Feb 25, 8:56 pm, rohit <[email protected]> wrote: > Hi, > > I am getting problem with progress bar progress event > > As per my requirment I am loading images at run time in a canvas > container. While loading image I am showing the progress bar for > individual image. The problem i am facing is for only the last image I > am able to show th eprogress bar > > private var progressBar:ProgressBar; > > for(var i:int = 0; i<6;i++) > { > var can:Canvas = new Canvas; > > var img:Image = new Image; > img.addEventListener(ProgressEvent.PROGRESS,imgProgressEvent); > img.addEventListener(Event.COMPLETE,removeLoadingBar); > > can.addChild(img); > > progressBar = new ProgressBar; > progressBar.width = 110; > progressBar.mode = "manual"; > progressBar.name = "loadingBar"; > progressBar.label = ""; > //progressBar.indeterminate = true; > progressBar.setStyle('fontSize',16); > progressBar.setStyle('color','#84A043'); > progressBar.x = ((can1.width - progressBar.width)/2) ; > progressBar.y = ((can1.height - progressBar.height)/2)-20 > can.addChild(progressBar); > > this.addChild(can); > > } > > public function imgProgressEvent(evt:ProgressEvent):void > { > var numPerc:Number = Math.round((Number(evt.bytesLoaded) / > Number(evt.bytesTotal)) * 100); > progressBar.setProgress(numPerc, 100); > progressBar.label = "";//'Loading: '+numPerc + "%"; > progressBar.validateNow(); > > } > > public function removeLoadingBar(evt:Event):void > { > evt.currentTarget.parent.removeChild(evt.currentTarget.parent.getChildByName('loadingBar') > as DisplayObject); > > } > > progress Listener shows only on the last bar ............... > > other bars are shows empty. Even i am able to remove the loader bar > from every container using complete event . -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.

