|
-
[RESOLVED] URLLoader ProgressEvent.PROGRESS Preloader Bug
I was having issues using URLLoader's progress event, even though it worked with a Loader version...and I even triple checked the code.
It would only trigger once after it is loaded. Well actually it would trigger like normal but none of the results will show/trace until the XML/text object was loaded. So basically a Preloader bar/percentage would jump to complete after the XML/Text Object has been loaded.
Well apparently it is a known bug.
http://bugs.adobe.com/jira/browse/FP-1959
Now my question is, is there a good/simple way around it?
I may have a workaround for my purpose, but I'm not sure it is translatable to work in most standard situations.
-
Can you just enterFrame it and query the bytesLoaded directly off the URLLoader instance?
-
I was trying to avoid using enterframe for consistency and preloader smotohenss, but it seems it can't be avoided.
The Sound PROGRESS event seems to be giving me the same thing as the URLLoader PROGRESS event. I tested it in my original code and made a test file to test it and make sure it was an audio progress event issue.
PHP Code:
import flash.events.Event; import flash.events.ProgressEvent; import flash.media.Sound; import flash.net.URLRequest; var s:Sound = new Sound(); s.addEventListener(ProgressEvent.PROGRESS, onLoadProgress); s.addEventListener(Event.COMPLETE, onLoadComplete); s.addEventListener(IOErrorEvent.IO_ERROR, onIOError); var req:URLRequest = new URLRequest("audio.mp3");
var loadProgress_txt:TextField = new TextField(); addChild(loadProgress_txt);
s.load(req); function onLoadProgress(event:ProgressEvent):void { var loadedPct:uint = Math.round(100 * (event.bytesLoaded / event.bytesTotal)); trace("The sound is " + loadedPct + "% loaded."); loadProgress_txt.text = "The sound is " + loadedPct + "% loaded."; } function onLoadComplete(event:Event):void { var localSound:Sound = event.target as Sound; localSound.play(); } function onIOError(event:IOErrorEvent) { trace("The sound could not be loaded: " + event.text); }
The audio file is 417kb in size.
Can anyone write an example using the enterframe event instead? I'll continue looking on my end, but I'm having trouble with it.
NOTE: What is the point of having a progress event if it doesn't show up until after it is completed?
-
hmmm it seems that my onEnterFrame event doesn't trigger until the sound is loaded? that seems kinda odd.
i know there are a bunch of geniuses out there who can help me out with this...
-
ah randomly stumbled onto this thread:
http://www.actionscript.org/forums/s....php3?t=209918
seems that even if it doesn't work locally (assuming the code is correct) it will work when uploaded.
Tested it with the MP3/audio but haven't tested it with XML.
-
ah randomly stumbled onto this thread:
http://www.actionscript.org/forums/s....php3?t=209918
seems that even if it doesn't work locally (assuming the code is correct) it will work when uploaded.
Tested it with the MP3/audio but haven't tested it with XML.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|