0

I am using flash cs 6 and as3. i am loading image from server. url is ......../....../images/باجندوح.png. am getting image when ever i enter this url in browser.but am running my code from flash builder am getting this error

"Error opening URL '..../...../images/باجندوح.png'
Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed"

.image is there in server folder .and in browser also it is loding in chrome but in mozilla and safari it is creating problem.appering ????? marks insted of arabic name. my code is :

var imgUrl:String = "...../........../images/باجندوح.png";
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
loader.load(new URLRequest(imgUrl));
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, infoIOErrorEvent);

Note:image name is in arabic format..if the image name is in english it is working fine.

Usha Kommuri
  • 71
  • 1
  • 11
  • Your image URL is not accessible to us. Host it in a place where we can access it to allow debugging, and update your question accordingly. – Gurtej Singh Sep 02 '15 at 07:46
  • recently i realized that.in chrome browser it is working fine.getting problem for mozilla and safari browser in windows also.getting ????.png insted of arabic text.@ Gurtej Singh. – Usha Kommuri Sep 02 '15 at 10:19
  • recently i realized that.in chrome browser it is working fine.getting problem for mozilla and safari browser in windows also.getting ????.png insted of arabic text.@ Gurtej Singh – Usha Kommuri Sep 02 '15 at 10:20
  • Yes, I tried it from a flex AIR project and the same code works, but it does not work from a AS3 project. This is interesting. The url is not getting resolved correctly. Any chance you can rename this to a english file name? – Gurtej Singh Sep 02 '15 at 10:31
  • No.I have to use arabic name only.I tink it is browser compatability problem (i tink problem with flash player version).@Gurtej Singh – Usha Kommuri Sep 02 '15 at 10:37
  • I was able to solve it finally :) The solution was to url encode the arabic part of the name before making the call. Answer below. – Gurtej Singh Sep 02 '15 at 10:58

2 Answers2

1

The problem is that the URL is not being resolved properly since there is arabic text and it's resolving to ?????.png. The solution was to encode the arabic part of the name before sending the request, and I was able to hit the image and get a successful response.

The encoding (encodeURI) correctly resolves the URL to:

http://......./......./...../%D8%A8%D8%A7%D8%AC%D9%86%D8%AF%D9%88%D8%AD.png

Use the following code:

var imgUrl:String = "http://....../..../...../";
var imgPart:String = "باجندوح";
var finalURL:String = imgUrl + encodeURI(imgPart) + ".png";
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, infoIOErrorEvent);
loader.load(new URLRequest(finalURL));

Hope this resolves your question.

Usha Kommuri
  • 71
  • 1
  • 11
Gurtej Singh
  • 3,244
  • 1
  • 14
  • 27
-1

Probably as3 can't read arabic letters and can't find the way. So you should add arabic letters on your project.

You can probably look here hope it helps : Arabic text in as3

Community
  • 1
  • 1
halilcakar
  • 1,628
  • 1
  • 12
  • 18