I'm using URLStream to download 30-80mb files over HTTP. It downloads fine on Windows XP, but is extremely laggy in OSX. Anyone had similar issues? Here's some snippets of the code.
function startDownload():void
{
//opening file
var FileWriteStream:FileStream = new FileStream();
FileWriteStream.openAsync(DownloadingFile, FileMode.WRITE);
//adding listeners to stream
URLReadStream = new URLStream();
URLReadStream.addEventListener(ProgressEvent.PROGRESS, trackCurrentDownload);
URLReadStream.addEventListener(Event.COMPLETE, downloadComplete);
URLReadStream.addEventListener(IOErrorEvent.IO_ERROR, downloadError);
URLReadStream.load(DownloadURLRequest);
function trackCurrentDownload(event:ProgressEvent):void
{
//update progress bars
DownloadProgress.setProgress(event.bytesLoaded+resumeSize, event.bytesTotal);
if (URLReadStream.bytesAvailable > 2048 || event.bytesLoaded == event.bytesTotal)
{
开发者_运维技巧 //read stream & write bytes to file
var byteArray:ByteArray = new ByteArray();
URLReadStream.readBytes(byteArray, 0, URLReadStream.bytesAvailable);
FileWriteStream.writeBytes(byteArray, 0, byteArray.length);
byteArray = null;
}
}
}
I've tried different buffer sizes. I even commented out the PROGRESS event, and it still was laggy. Obviously I close everything & remove listeners in the downloadComplete function. Has anyone removed the PROGRESS event listener in the callback and added it back at the end of the callback? I'm really stumped, especially since it works fine on Windows. Thanks for any help or suggestions.
There is an open bug on Adobe’s Jira about poor performance of Flash Player on Mac. The bug is still open. There are discussions on the Web regarding the issue : http://www.gskinner.com/blog/archives/2009/05/idle_cpu_usage.html http://blogs.adobe.com/air/2009/05/performance_tips_for_adobe_air.html
the first link has a solution i haven't tryed with modyfing the framerate .other then that flash player 10 should have improved performance , i would try and run the application on the new released air (2 beta) and see if performance improved
精彩评论