?
Solved

Getting Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. (despite valid URL)

Posted on 2011-03-17
20
Medium Priority
?
6,190 Views
Last Modified: 2012-05-11
Hello,

The below scrip throws an error after:
 loader.load(request)

I attached the project that you can import with the folder option of the import project window after unziping (change the extension to *.7z instead of *.txt)

Here is the trace:

[HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0 responseURL=null]
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: https://graph.facebook.com/PacktPub
      at controllers::CustomGraphContainerController()[C:\wamp\www\books\Facebook Graph API Development with Flash\Flash Builder\Chapter2_Start\src\controllers\CustomGraphContainerController.as:14]
      at Main/setUpGCC()[C:\wamp\www\books\Facebook Graph API Development with Flash\Flash Builder\Chapter2_Start\src\Main.as:71]
      at Main/init()[C:\wamp\www\books\Facebook Graph API Development with Flash\Flash Builder\Chapter2_Start\src\Main.as:34]
      at flash.display::DisplayObjectContainer/addChildAt()
      at flash.display::Stage/addChildAt()
      at Preloader/startup()[C:\wamp\www\books\Facebook Graph API Development with Flash\Flash Builder\Chapter2_Start\src\Preloader.as:61]
      at Preloader/loadingFinished()[C:\wamp\www\books\Facebook Graph API Development with Flash\Flash Builder\Chapter2_Start\src\Preloader.as:55]
      at Preloader/checkFrame()[C:\wamp\www\books\Facebook Graph API Development with Flash\Flash Builder\Chapter2_Start\src\Preloader.as:43] Chapter2-Start.txt
public function CustomGraphContainerController(a_graphControlContainer:GraphControlContainer)
		{
			super(a_graphControlContainer);
			var loader:URLLoader = new URLLoader();
			var request:URLRequest = new URLRequest();
			request.url = "https://graph.facebook.com/PacktPub";
			loader.addEventListener(Event.COMPLETE, onGraphDataLoadComplete);
			loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatusMessage);
			loader.load(request);
		}
		
		private function onGraphDataLoadComplete(a_event:Event):void 
		{
			var loader:URLLoader = a_event.target as URLLoader;
			var graphData:String = loader.data;
			trace(graphData);
		}
		
		public function onHttpStatusMessage(event:HTTPStatusEvent):void
		{
			trace(event.status + " -- " + event.toString());
		}

Open in new window

0
Comment
Question by:deve-lopez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 6
  • 4
20 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 35162348
you file is corrupted
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35162377
ioerror actually means the file is not present.
Can you directly call and access the page you are trying to load. Try loading that directly in browser and see first.

Warm Regards
Deepanjan Das
0
 
LVL 17

Assisted Solution

by:deepanjandas
deepanjandas earned 498 total points
ID: 35162382
May be add a IOError handler also:
loader.addEventListener(IOErrorEvent.IO_ERROR, onError);

private function onError(event:IOErrorEvent):void 
{
        trace(e);
}

Open in new window


Warm Regards
Deepanjan Das
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:deve-lopez
ID: 35162409
Yes the URL works.
I tried to run this from the disk and from a web host with a crossdomain.xml file but the issue remains.
I am on Windows XP with the latest CS5 installed by the way.

here is the result after tracing the IO_ERROR:

0 -- HTTPStatusEvent: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0 responseURL=null]

 -- IOErrorEvent: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://graph.facebook.com/PacktPub"]
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35162462
I think facebook checking user-agent header. What you cannot pass from Flash Player its available via AIR. But you can get responce using navigateToURL

var request:URLRequest = new URLRequest("https://graph.facebook.com/PacktPub");
navigateToURL(request, "_blank");

Workaround using PHP on your remote server and simulate browser agent using curl API's
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35162491
But if you want to use Facebook API you may need to use google code library

http://code.google.com/p/facebook-actionscript-api/
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35162499
When I run the Main.html, I see no errors.
Is that the file to test with?

Warm Regards
Deepanjan Das
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35162509
You will not see an error when you ran locally, but at same time loader.data is null.

deve-lopez, looks like wants to parse JSON file. He cannot use URLLoader in this case.

He may need to write JavaScript API and communicate with Flex using External APi or use Facebook API's for Flex
0
 
LVL 17

Assisted Solution

by:deepanjandas
deepanjandas earned 498 total points
ID: 35162540
Hi @dgofman, I am not sure why json data cannot be loaded using URLLoader.
Afterall the data will be a string and needs to be converted to JSON in the handler like this:

var data:Object = new JSONDecoder( event.data, true ).getValue();

But this error i guess has nothing to do with the type of data returned.

Warm Regards
Deepanjan Das
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35162552
Many web services validation an USER-AGET header.
For example Apple, you will never ever will able to download any applications from App Store if your browser is not running IPhone or IPad (whats is WebKit)

So, Facebook filtering request and sending NULL if user-agent is Flash Player
0
 

Author Comment

by:deve-lopez
ID: 35162950

I added the User-Agent to the Request but it does not look like it changes anything.
Using a network traffic monitoring tool I can confirm that the issue is in the FlashPlayer the request is never sent over the wire. Conclusion some lame security crap code is the problem.
Did anyone tested the project I uploaded succesfully on a windows XP machine?
I am asking cause I wonder if this is a bug on XP, I bet they did not test the latest Flash Builder on XP at Adobe... Let me know as this is driving me nuts...
What a waste of time for something that should be trivial...

Thanks to all of you for trying with me, let's solve that puzzling issue once for everyone else ;-)
0
 

Author Comment

by:deve-lopez
ID: 35162954
Updated sample code with the User-Agent header set:

request.url = "https://graph.facebook.com/PacktPub";
var header:URLRequestHeader = new URLRequestHeader("User-Agent","Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 YFF35 Firefox/3.6.15 ( .NET CLR 3.5.30729; .NET4.0E)");
request.requestHeaders.push(header);
loader.addEventListener(Event.COMPLETE, onGraphDataLoadComplete);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatusMessage);
loader.addEventListener(IOErrorEvent.IO_ERROR, error_handler);
loader.load(request);
0
 
LVL 29

Assisted Solution

by:dgofman
dgofman earned 1002 total points
ID: 35162985
Ok, finnaly I got JSON responce as string

<fx:Declarations>
   <mx:HTTPService id="srv" url="https://graph.facebook.com/PacktPub" result="onResult(event)"/>
</fx:Declarations>

private function onResult(event:ResultEvent):void{
      trace(event.result);
}

public function CustomGraphContainerController()
{
    srv.send();
}
0
 
LVL 29

Assisted Solution

by:dgofman
dgofman earned 1002 total points
ID: 35163152
hi  deve-lopez,
I don't know how are you able to execute your script on Flash Player using  "URLRequestHeader"  "User-Agent","Mozilla/5.0"
It was throw Error in my debugger.

Any way if you want to resolve your problem you need just add a sigle line:


var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("https://graph.facebook.com/PacktPub");
request.contentType = HTTPRequestMessage.CONTENT_TYPE_FORM;
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, onGraphDataLoadComplete);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatusMessage);
loader.load(request);
0
 
LVL 29

Expert Comment

by:dgofman
ID: 35173061
Hi deve-lopez,

I think request.contentType = "application/x-www-form-urlencoded";

should solve your problem.

Please can you update your status or close this question.

Thanks,
David
0
 

Author Comment

by:deve-lopez
ID: 35173241
@David
Hi!
I will try all your suggestions as soon as I can.
Thanks, D.
0
 

Author Comment

by:deve-lopez
ID: 35174706
The attached code is correct and works great on Mac but strike a security error on Windows XP.
Obviously Adobe made little testing of their player on XP, with more than 50% of the PC on the planet still running XP that sounds like a serious flaw for a product that market itself as the ultimate cross-platform solution.

Is there a way to flat out disable permanently all Flash security mechanism for a given flash project/executable?
package controllers
{
	import ui.GraphControlContainer;
	import flash.events.Event;
	import flash.events.HTTPStatusEvent;
	import flash.events.IOErrorEvent;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLRequestHeader;
	
	public class CustomGraphContainerController extends GCController
	{
		
		public function CustomGraphContainerController(a_graphControlContainer:GraphControlContainer)
		{
			super(a_graphControlContainer);
			var loader:URLLoader = new URLLoader();
			var request:URLRequest = new URLRequest();
			request.url = "https://graph.facebook.com/PacktPub";
			loader.addEventListener(Event.COMPLETE, onGraphDataLoadComplete);
			loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatusMessage);
			loader.addEventListener(IOErrorEvent.IO_ERROR, error_handler);
			loader.load(request);
		}
		
		private function onGraphDataLoadComplete(a_event:Event):void 
		{
			var loader:URLLoader = a_event.target as URLLoader;
			var graphData:String = loader.data;
			trace(graphData);
		}
		
		public function onHttpStatusMessage(event:HTTPStatusEvent):void
		{
			trace(event.status + " -- HTTPStatusEvent: " + event.toString());
		}
		
		public function error_handler(event:IOErrorEvent):void
		{
			trace(" -- IOErrorEvent: " + event.toString());
		}
		
	}

}

Open in new window

0
 
LVL 29

Accepted Solution

by:
dgofman earned 1002 total points
ID: 35176142
Your goal running Flash Player as standalone application. Convert SWF->EXE?
0
 
LVL 29

Assisted Solution

by:dgofman
dgofman earned 1002 total points
ID: 35176570
Hi deve-lopez,
I don't have WindowXP at home, but I was able to run code bellow on Windows 7 as SWF ans EXE.
I attached archive ZIP file, change extention from PNG - > ZIP


package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.HTTPStatusEvent;
	import flash.events.IOErrorEvent;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLRequestHeader;
	import flash.text.TextField;

	public class CustomGraphContainerController extends Sprite
	{
		private var _log:TextField;

		public function CustomGraphContainerController()
		{
			super();
			_log = new TextField();
			_log.multiline = true;
			_log.wordWrap = true;
			_log.width = stage.stageWidth;
			_log.height = stage.stageHeight;
			addChild(_log);

			var loader:URLLoader = new URLLoader();
			var request:URLRequest = new URLRequest();
			request.url = "https://graph.facebook.com/PacktPub";
			request.contentType = "application/x-www-form-urlencoded";
			loader.addEventListener(Event.COMPLETE, onGraphDataLoadComplete);
			loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatusMessage);
			loader.addEventListener(IOErrorEvent.IO_ERROR, error_handler);
			loader.load(request);
		}
		
		private function onGraphDataLoadComplete(a_event:Event):void 
		{
			var loader:URLLoader = a_event.target as URLLoader;
			var graphData:String = loader.data;
			_log.appendText(graphData + "\r\n");
		}
		
		public function onHttpStatusMessage(event:HTTPStatusEvent):void
		{
			_log.appendText(event.status + " -- HTTPStatusEvent: " + event.toString() + "\r\n");
		}
		
		public function error_handler(event:IOErrorEvent):void
		{
			_log.appendText(" -- IOErrorEvent: " + event.toString() + "\r\n");
		}
		
	}
	
} 

Open in new window



CustomGraphContainerController.png
0
 

Author Closing Comment

by:deve-lopez
ID: 35319185
Thanks for your help
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question