![]() |
|
||||||||||
|
|||||
|
[+1 17.02.10]
Регистрация: Aug 2009
Адрес: Казахстан Усть-Каменогорск
Сообщений: 249
|
Доброго времени.
Помогите. Какое свой-во прогресс бара отвечает за что бы он при загрузке или скачивании файлов заполнялся? проценты идут а сам он не заполняеться вот код private function initApp():void { Security.allowDomain("*"); } public function init(pb:ProgressBar, btn:Button):void { this.progBar = pb; this.btn1 = btn; fr = new FileReference(); fr.addEventListener(Event.OPEN, openHandler); fr.addEventListener(ProgressEvent.PROGRESS, progressHandler); fr.addEventListener(Event.COMPLETE, completeHandler); } public function startDownload():void { var request:URLRequest = new URLRequest(); request.url = DOWNLOAD_URL; fr.download(request); } private function openHandler(event:Event):void { progBar.label = "DOWNLOADING %3%%"; btn1.enabled = false; btn2.enabled = true; //CursorManager.setBusyCursor(); } private function progressHandler(event:ProgressEvent):void { //progBar.setProgress(event.bytesLoaded, event.bytesTotal); //label1.text=event.bytesLoaded.toString()+ ' байт из '+ event.bytesTotal.toString()+ ' байт.'; //progBar.validateNow(); var numPerc:Number = Math.round((Number(event.bytesLoaded) / Number(event.bytesTotal)) * 100); progBar.setProgress(numPerc, 100); progBar.label = numPerc + "%"; progBar.validateNow(); } private function completeHandler(event:Event):void { progBar.label = "DOWNLOAD COMPLETE"; btn1.enabled = true; btn2.enabled = false; //CursorManager.removeBusyCursor(); } public function cancelDownload():void { fr.cancel(); progBar.label = "DOWNLOAD CANCELLED"; btn1.enabled = true; btn2.enabled = false; //CursorManager.removeBusyCursor(); } ]]> </mx:Script> <mx:Panel layout="absolute" left="10" bottom="10" top="10" right="10"> <mx:Button x="10" y="10" label="Download" id="btn1" click="init(progBar,btn1);startDownload();"/> <mx:ProgressBar x="10" y="40" id="progBar" width="461" label=" "/> <mx:Button x="100" y="10" label="Cancel" click="cancelDownload();" width="82" enabled="false" id="btn2"/> <mx:Label x="190" y="12" text="Label" id="label1"/> </mx:Panel> </mx:Application> |
|
|||||
|
[+1 10.12.10]
|
надо так
ну и режим бара |
|
|||||
|
[+1 17.02.10]
Регистрация: Aug 2009
Адрес: Казахстан Усть-Каменогорск
Сообщений: 249
|
ОГРОМНОЕ СПАСИБО!!! получается что progBar.mode = ProgressBarMode.MANUAL; отвечает за то что бы линейка двигалась?
|
|
|||||
|
[+1 10.12.10]
|
что бы линейку можно было двигать руками.(setProgress)
|
![]() |
![]() |
Часовой пояс GMT +4, время: 23:31. |
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | |
| Опции просмотра | |
|
|