Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Actionscript [Error #2036: Load Never Completed] with dynamic generated images

I'm working with an image caching system that generates different images based on a url route. The source images live outside the document root and cached versions are added to /cache in the webroot. Long story short, in Flash, if I point a Loader to the route, I get a "Load Never Completed" error the first time (if the cached image has yet to be generated).

Error opening URL 'http://characters.dev/cache/Pledges/16107/48_48c/jen001.jpg'
Error #2036: Load Never Completed. URL: http://characters.dev/cache/Pledges/16107/48_48c/jen001.jpg

The cached image is still generated and the next time I run the application the actual file loads without error. I've got the proper headers being sent when generating the initial image and writing it, so I'm wondering why flash isn't getting the response (seems to works fine in a browser window).

header("Content-type:image/jpeg");
echo $this->getResponse()->setBody(file_get_contents($cachedFile));

Any ideas on how to fix this? The errors seems to "bog down" the flash application.


If it helps, here's the response headers:

Request to generate image:

HTTP/1.1 200 OK
Date: Tue, 23 Jun 2009 17:52:49 GMT
Server: Apache
X-Powered-By: PHP/5.2.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=6b746d4ed010c288a824522597698ea2; expires=Fri, 24-Jul-2009 17:52:50 GMT; path=/; domain=.characters.dev
Content-Length: 3575
Content-Type: image/jpeg

Request when image is cached:

HTTP/1.1 200 OK
Date: Tue, 23 Jun 2009 17:53:27 GMT
Server: Apache
Last-Modified: Tue, 23 Jun 2009 17:52:50 GMT
ETag: "24e6c62-df7-a8bd0080"
Accept-Ranges: bytes
Content-Length: 3575
Content-Type: image/jpeg
like image 524
typeoneerror Avatar asked Jun 23 '09 17:06

typeoneerror


2 Answers

I was getting a similar issue, to stop the error appearing you want to catch the IOErrorEvent.IO_Error

_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError_handler, false, 0, true);

public function ioError_handler(event:IOErrorEvent):void
{
   Alert.show(event.toString());
}

Whilst this got rid of the error, some of the images where not loading in Opera. In the end I got this to work by changing the image handler code (asp.net c#) to

context.Response.ClearContent();
context.Response.ClearHeaders();
context.Response.ContentType = "image/jpg";
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.Cache.SetNoStore();
context.Response.Cache.SetExpires(DateTime.MinValue);
context.Response.BufferOutput = false;
context.Response.BinaryWrite(photo);

before when I tried to view the image in the browser the photo would load, but it wouldn't finish loading in Opera, hence not firing the load complete event.

Hope this helps, (even if it is in a different language)

like image 117
Ian Avatar answered Sep 29 '22 23:09

Ian


Flash IDE issue it seems. Not really fixable.

like image 39
typeoneerror Avatar answered Sep 29 '22 22:09

typeoneerror