Skip to main content
Patel Bharat
Inspiring
July 27, 2009
Answered

URLLoader IO error

  • July 27, 2009
  • 2 replies
  • 2900 views

Hi All,

I want to get information about internet connection using flash code. So that i am loading an xml from server onEnterFrame. And if the internet connection is lost then the URLLoader should give an IO error.

To handle the onErnterFrame event i am using the following function :

function onEnterFrameHandler(event:Event):void
{
      _connection_Status_XML_Loader = new URLLoader();  
      _connection_Status_XML_Loader.addEventListener(IOErrorEvent.IO_ERROR, connectionErrorHandler);
      _connection_Status_XML_Loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, connectionHttpStatusHandler);
      _connection_Status_XML_Loader.addEventListener(Event.COMPLETE,connectionStatusHandler);
      var request:URLRequest = new URLRequest(serverPath+"abc.xml"+ "?"+Math.random());
     try

     {   
          _connection_Status_XML_Loader.load(request);
     }

     catch (error:Error)
     {   
           trace("Unable to load requested document");
     }
}

Normally, if i run the application in flash player then i will mostly got the message as


"Error opening URL 'http://servername/abc.xml?0.1506041861139238'"

several time becous i am trying to load xml in onEnterFrame. But in between sometime i got error message as :

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://servername/abc.xml?0.2708006724715233
at ConnectionTest/onEnterFrameHandler()

Can anyone guide me ?

Thanks in Advance.

Bharat Patel

This topic has been closed for replies.
Correct answer funkysoul

correct me if I'm wrong but shouldn' the urlrequest call:

var request:URLRequest = new URLRequest(serverPath+"abc.xml"+ "?rand="+Math.random());

And I would definately remove the this call from the onEnterFrame, do a own function for it which gets called when your app is running.

2 replies

funkysoul
funkysoulCorrect answer
Inspiring
July 27, 2009

correct me if I'm wrong but shouldn' the urlrequest call:

var request:URLRequest = new URLRequest(serverPath+"abc.xml"+ "?rand="+Math.random());

And I would definately remove the this call from the onEnterFrame, do a own function for it which gets called when your app is running.

July 27, 2009

Hi Bharat Patel,

What are you trying to do with the enterframe function?

Why don't you try to do the same concept by loading one after another?

Also, did you try removing the Math.Random() from xml path string?

- Varun

Patel Bharat
Inspiring
July 28, 2009

Hi Varun and Expert,

I am thankful to you to you both to guide me and give time. Now, I had removed the onEnterFrame and insted of that i had used an function. So the issue is fixed.

Bharat Patel