Here is the typical example used to illustrate the problem:
Here is the FXG source code (rounded_box_scale9.fxg) used to create this graphic. Notice the scaleGridLeft, scaleGridTop, scaleGridRight, and scaleGridBottom properties, these are what control the scaling.
<s:Graphic xmlns:s="http://ns.adobe.com/fxg/2008" version="2.0" scaleGridTop="20" scaleGridLeft="20" scaleGridRight="130" scaleGridBottom="21"> <s:Rect height="41" width="150" radiusX="20"> <s:fill> <s:LinearGradient rotation="90"> <s:GradientEntry color="#FFFFFF"/> <s:GradientEntry color="#C0C0C0"/> <s:GradientEntry color="#FFFFFF"/> </s:LinearGradient> </s:fill> <s:stroke> <s:SolidColorStroke color="#AAAAAA" weight="2"/> </s:stroke> </s:Rect> </s:Graphic>
And here is the associated MXML (the rounded_box fxg doesn't have the scaleGrid properties):
<s:VGroup x="10" y="10" gap="10"> <fxg:rounded_box/> <fxg:rounded_box width="100"/> <fxg:rounded_box width="200"/> <fxg:rounded_box_scale9 width="100"/> <fxg:rounded_box_scale9 width="200"/> </s:VGroup>
I found this website quite useful in illustrating some of the scale grid limitations: http://www.adobe.com/devnet/flex/articles/mobile-skinning-part1.html.
And here is Adobe's page on FXG:
http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f26c150d412357de3591-8000.html.
But to summarize, here are the limitations I've found with scale grids:
- Scale grid values must be inside the boundaries of the graphic and must not overlap
(that is, left boundary < scaleGridLeft < scaleGridRight < right boundary). - Scale grids will not work if the graphic contains any Group elements.
- Scale grids will not work if elements have alpha applied. Instead, apply alpha to the stroke and fill elements.
- Scale grids will not work with filters (e.g. DropShadow, GlowFilter, etc). Instead add the filters inside the MXML.
1 comment:
Thanks for sharing, I will bookmark and be back again
Flash Development
Post a Comment