OK, I give up, this is the problem:
If we have a Bitamp with more than 16777216 pixels (or one side larger than 8191 px) Flash 10 doesn’t show it (Flash 9 and earlier has smaller limits even).
One solution to this is to use scrollRect to limit the size displayed.
OK, that works.
But Flash 10 has another problem, if we use any 3D property (rotationX, z, etc), flash transforms your MC in bitmap, so we can reach the above limit even when we are not working with bitmaps…
A bigger problem is that although our MC could be really small (at least less than 16777216 pixels), when we apply a 3D transform like rotationX, the displayed MC can grows enough to reach the limit.
And… we can’t use scrollRect with 3D MC.
But we have a trick here too, there are two ways to use scrollRect with 3D:
- explained here: http://blog.formatlos.de/2009/02/16/masking-a-3d-container-in-as3-fp1/
When you define a sprite for 3d properties, define another child sprite in it for 2d rendering. Do all coordinate and 3d operations in the parent and 2d rendering in the child. That worked perfect[including scrollRect(in child)] - Explained here: http://kb2.adobe.com/cps/408/kb408334.html
To work around this limitation:- Create a 2D parent, then create the 3D displayObject inside of that parent.
- Set cacheAsBitmap to true for the 2D parent.
- Create a grandparent container to hold the first two items.
- Set cacheAsBitmap to true for the grandparent container.
- Apply scrollRect to the grandparent container.
These methods are really differents, with the second I couldn’t use scrollRect to avoid reaching the bitmap limit. I think that’s because in the second we apply scrollRect to the parent and 3D to the child, so nothing breakes our child from growing.
With the firs method we apply scrollRect to the child, and the 3D property to the parent.
But !!! of course here is the problem, first I will put the code that works:
var p: Sprite = new Sprite();
var c: Sprite = new Sprite();
p.addChild(c);
c.graphics.beginFill(0x0000F0);
c.graphics.drawRoundRect(0,0,9000,9000,5);
c.graphics.endFill();
c.scrollRect = new Rectangle(0,0,100,50);
p.rotationX=45;
addChild(p);
How we can see our MC is 9000x9000 bot with scrollRect we are controlling the overflow.
Now add another child:
var p: Sprite = new Sprite();
var c: Sprite = new Sprite();
p.addChild(c);
c.graphics.beginFill(0x0000F0);
c.graphics.drawRoundRect(0,0,9000,9000,5);
c.graphics.endFill();
c.scrollRect = new Rectangle(0,0,100,50);
p.rotationX=45;
addChild(p);
var c2: Sprite = new Sprite();
c.addChild(c2);
c2.z = 0; //here the problem
We get the classic error:
“Warning: 3D DisplayObject will not render. Its dimensions (XXXX, XXXX) are too large to be drawn.”
even when the c2 child is empty !
So, I think there’s a problem with the transform.matrix3D property, if it’s not null, then we can’t use scrollRect.
And if we have a MC with a 3D parent and a 3D child, then the MC becomes 3D too (sandwich’s theorem ^_^)
http://www.bit-101.com/blog/?p=2391
I don’t know how to solve this.
I have a big (not enough to reach the limit by itself but yes when I apply some transformation like a rotation or zoom) MC which needs 3D transformations, inside it there are others MC with 3D too.
I hope somebody help me
THANKS !!!
enri.