Maybe you are adding listeners to the wrong thing?  Because you should get 
those events when it does work.


On 3/24/12 4:00 PM, "nagaofthesea" <nagaofthe...@yahoo.com> wrote:






Howdy All-

PROBLEM:
Strange URLLoader.load() behavior: sometimes it works; sometimes it doesn't.  
Can't step through airglobal.swc to see what's wrong.

DETAILS:
I am using the latest SDK in several versions of an AIR project.  The core code 
is identical across versions of the project.  Most changes are just in the 
presentation of the data.

I am a Cairngorm nut and I have extended it to suit my coding style.  I have a 
"master" AbstractCommand that addresses everything including listener 
add/remove, SQLite management, remote services, and File reading/writing.  I 
just override certain functions as needed.

In this project I read RSS beginning with the following:

override public function execute(event:CairngormEvent):void
{
 trace("LoadFeedCommand.execute() called");

 var rsso:RSSObject = LoadFeedEvent(event).feedObject;
 var urlRequest:URLRequest = new URLRequest(rsso.url);

 loader = new URLLoader();
 addListeners(loader);

 try
 {
 loader.load(urlRequest);
 trace("loader.load() called");
 }
 catch(error:Error)
 {
 trace("problem with loader.load()");
 }

 tModelLocator.displayModel.selectedRSSObject = rsso;
}

In some of the projects URLLoader.load() works as expected.  In others with 
IDENTICAL code it does not. URLLoader.load() fails into nothingness.  The catch 
clause does not throw an Error.

I have added the following listneres in overrided .addListeners() and nothing 
gets called!

override public function addListeners(target:Object):void
{
 target.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
 target.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, onHTTPStatus, 
false,0, true);
 target.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
 target.addEventListener(Event.OPEN, onOpen, false, 0, true);
 target.addEventListener(ProgressEvent.PROGRESS, onProgress, false, 0, true);
 target.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError, 
false, 0, true);
}

Any insight on this would be wonderful.

Thanks,
-Naga






--
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui

Reply via email to