Archive for September, 2008

beyond 8191px

The limit of 8191px (or 0×1FFF in hex) is probably less known but it’s actually the maximum size for DisplayObjects. If your objects width or height is greater than this limit it won’t get rendered anymore.
I mentioned in an earlier post that you can create even bigger DisplayObjects with BitmapDataUnlimited. This is still true even though there are a few restrictions.

I put together a small demo to show you my results:
http://projects.formatlos.de/spiking/1fff/
click inside the window to gain Keyboard focus,
use your arrow keys to move the container 1px (hold shift: 10px, hold alt: 100px)

add via Bitmap, no scale

...
// hugeBitmapData: w=9000, h=10
container.addChild(new Bitmap(hugeBitmapData));
...

This is probably the most convenient way to add a BitmapData to the stage. As you can see in the demo this works perfectly.

add via Bitmap, scale -> width=8191

...
// hugeBitmapData: w=9000, h=10
container.addChild(new Bitmap(hugeBitmapData));
container.width = 8191;
...

The same as above, just scaling down the Sprite to 8191px. It seems to work but moving the container some px to the right shows a strange rendering behaviour.

add via Bitmap, scale -> width=8192

...
// hugeBitmapData: w=9000, h=10
container.addChild(new Bitmap(hugeBitmapData));
container.width = 8192;
...

This time scaling down the Sprite to 8192px which is 1px above the limit and therefore doesn’t get rendered. moving the container some px to the right shows the same strange rendering behaviour again.
If you move the container off the stage (to the left) the exact amout of px exceeding the limit, in our case 1px, the Sprite gets rendered again. I presume Flash Player calculates the significant width/height based on the DisplayObjects bounds relating to the stage and by moving the Sprite off the stage the width/height which has to be rendered is smaller than the limit.

add via graphics, scale -> width=8192

...
// hugeBitmapData: w=9000, h=10
container.graphics.beginBitmapFill(hugeBitmapData);
container.graphics.drawRect(0,0,hugeBitmapData.rect.width,hugeBitmapData.rect.height);
container.graphics.endFill();
container.width = 8192;
...

Apparently there is no such limit for the Graphics Object therefore you can use beginBitmapFill and drawRect to draw your BitmapData to a Sprite and scale it afterwards.


Download Demo Source

stereosucker.de

One of my latest projects just launched last week. It’s a portfolio site for visual artist and interface designer stereosucker aka Tine Päch.

The site is completely dynamic and provides deep linking and browser button support through SWFAddress.

homepage

Homepage

projectpage

Projectpage

About

Martin Rädlinger is an Interactive Developer & Designer. He specializes in interactive coding predominantly with ActionScript, but every new challenge is welcome. If you like his work feel free to get in touch with him. At the moment he's available for freelance work.

Contact

Martin Rädlinger
mail: mr [at] formatlos.de
web: www.formatlos.de
xing: Martin Rädlinger
linkedin: Martin Rädlinger
skype: martinraedlinger