View Full Version : ProgressEvent.url non-existent?
chartermatrix
08-12-2008, 07:27 PM
I have multiple downloads calling eProgress.
I guess ProgressEvent does not have the url property Event has?
How can I access the filename beign downloaded.
function eProgress(e:ProgressEvent):void
{
trace(e.target.url); // Null
}
pj-co
08-12-2008, 07:57 PM
the target that is dispatching the event is a loader info object
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/LoaderInfo.html
chartermatrix
08-12-2008, 08:03 PM
the target that is dispatching the event is a loader info object
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/LoaderInfo.html
So why do I get Null when tracing?
pj-co
08-12-2008, 08:08 PM
because loader info objects dont have that property
read the link I gave you and look under the properties section and see if there is a property that might do what you need. I think you will be pleasantly surprised. ;)
Also, if you want, post the code where you add the listener. that part can be tricky and might effect the outcome.
chartermatrix
08-13-2008, 04:09 AM
because loader info objects dont have that property
read the link I gave you and look under the properties section and see if there is a property that might do what you need. I think you will be pleasantly surprised. ;)
Also, if you want, post the code where you add the listener. that part can be tricky and might effect the outcome.
Now I am confused. I am looking under the properties section and I do see the URL property. If its returning Null that means its not undefined which means it exists right? Please explain. Obviously I'm missing something.
pj-co
08-13-2008, 08:56 AM
Ah you are right sorry, it does have that property. That was bad advice I gave you.
Anyways can you post the code where you add the listener and start the loading process?
chartermatrix
08-13-2008, 01:02 PM
Ah you are right sorry, it does have that property. That was bad advice I gave you.
Anyways can you post the code where you add the listener and start the loading process?
protected function loadLayer(sURL:String)
{
var myL:Loader = new Loader();
var myR:URLRequest = new URLRequest(sMapPath + sURL);
myL.contentLoaderInfo.addEventListener(ProgressEve nt.PROGRESS, onProgress);
myL.contentLoaderInfo.addEventListener(Event.COMPL ETE, layerComplete);
myL.load(myR);
}
protected function layerComplete(e:Event):void
{
trace('Layer Complete In Map.as');
}
private function onProgress(e:ProgressEvent)
{
bytesDown = e.bytesLoaded;
bytesUp = e.bytesTotal;
trace(e.currentTarget.url + ': ' + bytesDown + ' ' + bytesUp);
}
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.