I came across something worth keeping in mind when working with Bitmaps in ActionScript 3.0 yesterday. I was working with a large jpeg (10000 pixels wide) that I wanted to load into a Bitmap programatically. I was able to load the image and could confirm the load had completed by firing an event on complete. However, the image wouldn't render on the stage. I tried exactly the same code with on a jpeg with smaller dimensions (500 pixels wide) and found that everything worked as expected. It was at this point I realised it was quite obviously related to the size of the image and so I decided to do some trial and error. The result I found was that the 'width' and 'height' property of the 'Bitmap' class only supports an integer up to 8191. Apparently Adobe thought 12 bits would be more appropriate than 16 (which would've allowed dimensions up to 65535). I imagine the class could be extended quite easily to allow for larger dimensions, but I didn't go down this path just yet.
Also, before anyone asks why you'd want to work with such large jpegs... the project I'm working on required the creation of a storyboard of 360 movie frames (each one 500x332 pixels). This storyboard took approximately 4 minutes to load when requesting each frame individually (through 360 HTTP request), but by compiling the frames server-side into a single storyboard and sending the jpeg in a single HTTP request, this time was reduced to around 15 seconds.
0 comments:
Post a Comment