Using Flash peer to peer to share files. How to display a progress bar to the downloading client?
I am trying to implement the actionscript program described at this address. http://cookbooks.adobe.com/post_Create_a_P2P_file_sharing_application-16539.html. It lets two flash client connect to the cirrus service and share a file using the flash peer to peer facilities.
The problem is that I would like to display a progress bar to the downloading client for long files. There does not seem to be any progress-type event been trig开发者_开发技巧gered by data sent by NetStream.Send. This particular function appears to have been created by adobe to send tiny update and meta-data code.
Is there a way to display a progress bar of downloaded data when using a netstream object?
The alternative would be to break the data into small packets and send them individually; then increment the progress bar as they are received by the client. Unfortunately this creates a lot of overhead for the simple problem of displaying a progress bar.
if you still need this, check out the object replication feature of the Cocoon P2P project which gives you all you need including progress events:
http://code.google.com/p/cocoon-p2p/
http://code.google.com/p/cocoon-p2p/wiki/ObjectReplication
You are right, breaking the data into chunks is the way to go to create a progress bar.
精彩评论