My favorites | Sign in
Project Logo
             
Search
for
Updated Feb 01, 2009 by jessefreeman
CamoDisplay  
One-sentence summary of this page.

Introduction

The CamoDisplay inherits some powerful layout logic from the BoxModelDisplay and extends the applyStyle method by supporting additional CSS properties. Here is a list of the properties supported by the CamoDisplay:

Details

CSS Property Values Example (px is stripped out by the parser)
align "left (default) center right" align: left; the logic for this should be in another Class that extends the CamoDisplay or add’s the CamoDisplay to its display list.
alpha "value range 0 - 1" alpha: .5; sets the alpha to 50%;
cursor "hand pointer none" cursor: pointer; this is a read only property. The actual logic to manage the cursor should be done in a class that extends the CamoDisplay.
overflow "visible(default) hidden" overflow: visible; any graphics outside of the display’s css width and height will be displayed.
overflow: hidden; the display is masked off based on the style’s width and height. If no width and height is set in the style the mask not work correctly.
rotation value rotation:180; sets the rotation to 180.
scale9Grid "values for x y width height" scale9Grid: 1px 1px 98px 48px; applies a rectangle to the CamoDisplay’s scale9Grid property.
vertical-align "top (default) middle bottom" vertical-align: top; the logic for this should be in another Class that extends the CamoDisplay or adds the CamoDisplay to its display list.
visibility "visible(default) hidden" visibility: hidden; sets visible to false;
x value x: 10px; sets the x position to 10;
y value y: 10px; sets the y position to 10;
z-index value z-index: 5; This is supported in the CamoDisplay addChild is called.

The most important functionality added by the CamoDisplay is the rasterize method. Just like the BoxModelDisplay which draws its border, background-color, and background-image to the graphics layer to save memory, the CamoDisplay can do the same thing with it’s display Sprite. When you call rasterize, a Bitmap snapshot of the display is take, the old display is removed and a new one is put in its place with the previous display's BitmapData drawn to it’s graphics layer. All the children that were attached to the display are removed (so the Garbage Collector can release them from memory) and you are left with a flattened display.

It is important to note that rasterize can only be called once since all children in the display are removed. The speed and memory benefits can greatly increase the performance of your application. This also allows you to layer images in the display Sprite and then flatten them into a single image. Rasterize should be used on any CamoDisplay where its children will never be changed or used outside of the initial setup of the class.

5 Calling the refresh method on a BoxModelDisplay is considered expensive and should only be used when needed.

6 Margin is not accounted for in offset of the display sprite unlike Padding. Instead Margin is a value accessible through the margin property and should be used by classes that layout or align BoxModelDeisplays.


Sign in to add a comment
Hosted by Google Code