a_pedestrian
12-01-2007, 04:04 AM
Thanks for your time.
I'm working on setting up terse syntax for an external text loader, but I'm still not thoroughly understanding the following line:
loadit.addEventListener(Event.COMPLETE, completeHandler)
I've defined completeHandler below with an argument of event:Event, but I'm not sure how to get a second argument passed into that function while still maintaining the event. I tried this:
function completeHandler(event:Event, boxname:TextField)
...
loadit.addEventListener(Event.COMPLETE, completeHandler(Event.COMPLETE, boxname))
But I got the error "Implicit coercion of a value of type String to an unrelated type in flash.events:Event".
Does anyone know why this happens, or how to fix it?
PS: loadit is declared with "var loadit:URLLoader = new URLLoader();" and its dataFormat has been set as URLLoaderDataFormat.TEXT.
I'm working on setting up terse syntax for an external text loader, but I'm still not thoroughly understanding the following line:
loadit.addEventListener(Event.COMPLETE, completeHandler)
I've defined completeHandler below with an argument of event:Event, but I'm not sure how to get a second argument passed into that function while still maintaining the event. I tried this:
function completeHandler(event:Event, boxname:TextField)
...
loadit.addEventListener(Event.COMPLETE, completeHandler(Event.COMPLETE, boxname))
But I got the error "Implicit coercion of a value of type String to an unrelated type in flash.events:Event".
Does anyone know why this happens, or how to fix it?
PS: loadit is declared with "var loadit:URLLoader = new URLLoader();" and its dataFormat has been set as URLLoaderDataFormat.TEXT.