PNGs alpha transparancy in AS3 - Unknown file-type
- by WiseDonkey
Hello there!
After whittling down of the options we've encountered a problem with PNG's and ActionScript 3 (AS3).
When loading a PNG 8 or PNG 32 with alpha transparancy we're getting the following error reported in Flash:-
"Error #2124: Loaded file is an unknown type"
Now, we're dealing with some legacy images, and it appears as though this problem isn't universal - some images believed to be 32bit alpha PNG are loading. BUT, some conclusions:-
converting one image that was 32 bit alpha (NOT WORKING IN AS3) to PNG 8 index transparency DID work.
And converting that same image to PNG 8 alpha DID NOT work.
These all worked in AS2
There is no difference between the headers
Headers of a Failing Image
[0] => HTTP/1.1 200 OK
[1] => Date: Tue, 06 Apr 2010 14:17:28 GMT
[2] => Server: Apache/2.2.3 (Red Hat)
[3] => Last-Modified: Tue, 06 Apr 2010 13:44:05 GMT
[4] => ETag: "3700054-11d6-a3983340"
[5] => Accept-Ranges: bytes
[6] => Content-Length: 4566
[7] => Connection: close
[8] => Content-Type: image/png
Headers of a Working Image
[0] => HTTP/1.1 200 OK
[1] => Date: Tue, 06 Apr 2010 14:19:02 GMT
[2] => Server: Apache/2.2.3 (Red Hat)
[3] => Last-Modified: Fri, 30 Oct 2009 18:38:08 GMT
[4] => ETag: "ba8057-65f2-5445c400"
[5] => Accept-Ranges: bytes
[6] => Content-Length: 26098
[7] => Connection: close
[8] => Content-Type: image/png
Any thoughts of a direction of further investigation or thoughts on a bewildering problem with little to no documentation; very warmly welcomed.
EDIT
Now it would appear as though something in the PHP conversion of the images is shafting; I use the following PHP to add alpha layers:-
imagealphablending($image_p, false);
ImageSaveAlpha($image_p, true);
ImageFill($image_p, 0, 0, IMG_COLOR_TRANSPARENT);