-
Event.Open
Trying to get the bytesTotal upon the beginning of downloading an external. Here's part of the code:
PHP Code:
myLoader.addEventListener (Event.OPEN, onOpen);
function onOpen (event:Event):void {
trace (event.bytesTotal);
};
1119: Access of possibly undefined property bytesTotal through a reference with static type flash.events:Event.
Anyone know what's going wrong and a correction?
-
bytesTotal is not a property of Event, but of the LoaderInfo object on the loader, so you'd need to do:
myLoader.contentLoaderInfo.bytesTotal
or
event.currentTarget.contentLoaderInfo.bytesTotal
-
Using:
myLoader.contentLoaderInfo.bytesTotal
Works but returns 0...not the the total bytes of the file??
I'd prefer to use:
event.currentTarget.contentLoaderInfo.bytesTotal
But it's returning error #1069??
-
i believe Event.OPEN broadcasts prior to receiving any data about the file, so you'd probably have to get it from the ProgressEvent.PROGRESS
myLoader.contentLoaderInfo.addEventListener(Progre ssEvent.PROGRESS, this.fileLoadOpen);
// and
function fileLoadOpen(e:Event):void
{
trace(e.currentTarget.bytesTotal)
}
-
Total Universe Mod
Event.OPEN is not recommended. It's nice for debugging but IE reacts differently than Firefox, Air and standalone players. IE broadcasts Event.OPEN regardless if the file was found or not while the others will only broadcast it if the file is found.
Use ProgressEvent.PROGRESS as StunnedGrowth mentioned.
-
The only dilemma is I only wanted to get the info once...when the download started...is progress the only option?
-
Still haven't figured it out.
Here's the goal:
Have one loading animation track the main timeline download and several xml files. My thought was to create a variable ("total") to hold the total bytes of all the files. Adding to it at the beginning of each download. I'm yet to find a way to accomplish this....help.
On progress I was planning on adding to a variable ("progress") to track the progress. The loading animation would evaluate the variables "total" and "progress".
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
|