Adobe Flex

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentAdobe Flex

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old July 6th, 2011, 04:41 PM
bon_t bon_t is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 25 bon_t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 51 m 26 sec
Reputation Power: 0
How to properly use ProgressEvent's bytesLoaded and bytesTotal for file download

Hi All,

I am using Flex 4, Actionscript 3.

I am using FileReference's download method, which automatically opens the "Save As" dialog window (ie. I don't have to explicitly call browse like for an upload).

I'd like the label of my ProgressBar component to display
downloading <%> ...

In my ProgressEvent handler, I tried
Code:
	prgbr_fileDownload.label = "downloading %3%%...";
	prgbr_fileDownload.setProgress( event.bytesLoaded, event.bytesTotal );

But this just displayed "downloading ...". I already set the mode of my ProgressBar component to "manual".

I then tried
Code:
prgbr_fileDownload.label = "downloading " + Math.round( ( event.bytesLoaded/event.bytesTotal ) * 100 ) + "% ...";

And I was shocked to see very large numbers.

I then noticed my trace statements displaying the following:
Code:
progressHandler name = g2.zip bytesLoaded = 98304 bytesTotal = 98304
progressHandler name = g2.zip bytesLoaded = 196608 bytesTotal = 98304
progressHandler name = g2.zip bytesLoaded = 377421 bytesTotal = 98304
etc.
progressHandler name = g2.zip bytesLoaded = 17820389 bytesTotal = 98304
progressHandler name = g2.zip bytesLoaded = 17829381 bytesTotal = 98304
progressHandler name = g2.zip bytesLoaded = 17838373 bytesTotal = 98304
etc.
progressHandler name = g2.zip bytesLoaded = 29940557 bytesTotal = 98304
progressHandler name = g2.zip bytesLoaded = 30012485 bytesTotal = 98304
progressHandler name = g2.zip bytesLoaded = 30103874 bytesTotal = 98304

Hence, obviously my last computation would not work.

How can I get the percentage downloaded to be displayed correctly?

Thanks,
Bonnie

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentAdobe Flex > How to properly use ProgressEvent's bytesLoaded and bytesTotal for file download


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap