blob: 2ab5bdffc97746e34fe75d045ced860bb9831607 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta name="DC.Type" content="topic"/>
<meta name="DC.Title" content="FXG and MXML graphics"/>
<meta name="DC.Format" content="XHTML"/>
<meta name="DC.Identifier" content="WS145DAB0B-A958-423f-8A01-12B679BA0CC7_verapache"/>
<title>FXG and MXML graphics</title>
</head>
<body id="WS145DAB0B-A958-423f-8A01-12B679BA0CC7_verapache"><a name="WS145DAB0B-A958-423f-8A01-12B679BA0CC7_verapache"><!-- --></a>
<div>
<div class="p">Adding graphics to your applications can make them more
attractive and usable. In many cases, you might want to add graphics
that are vector-based, and not import images that don't scale well.
You can create vector based graphics in Flex by using one of the
following APIs: <ul>
<li>
<p>FXG</p>
</li>
<li>
<p>MXML graphics</p>
</li>
</ul>
</div>
<p>FXG is a declarative syntax for defining static graphics. You
typically use an Adobe<sup>®</sup> graphics tool to export an FXG document,
and then use the FXG document as an optimized component in your
application. FXG graphics are used by the mobile skin classes because
they are so lightweight.</p>
<p>MXML graphics, on the other hand, are a collection of classes
that you use to define interactive graphics. You can add interactivity
to MXML graphics code because they use classes in the Flex SDK that
are subclasses of GraphicElement. The result is not as optimized
as FXG.</p>
<div class="p">FXG and MXML graphics define the following:<ul>
<li>
<p>Graphics
and text primitives</p>
</li>
<li>
<p>Fills, strokes, gradients, and bitmaps</p>
</li>
<li>
<p>Support for effects such as filters, masks, alphas, transforms,
and blend modes</p>
</li>
</ul>
</div>
<p>FXG and MXML graphics share very similar syntax. For example,
in FXG, you can define a rectangle with the <samp class="codeph">&lt;Rect&gt;</samp> tag.
In MXML graphics, you use the <samp class="codeph">&lt;s:Rect&gt;</samp> tag.
Most FXG elements have MXML graphics equivalents, although the attributes
supported on FXG elements are only a subset of those supported on
MXML graphics tags.</p>
<p>The amount of interactivity when using FXG and MXML graphics
is different. If you use MXML graphics, the tags are mapped to their
backing ActionScript implementations during compilation. You can
reference the MXML graphic elements and have greater control over
them in your code. If you use FXG, then you cannot reference instances
of objects within the FXG document from the application or other
components. In addition, you cannot add MXML code to it, nor can
you add ActionScript.</p>
<p>FXG and MXML graphics do not share the same namespace. MXML graphics
use the MXML namespace of the containing document. In most cases,
this is the Spark namespace. An FXG document uses its own namespace.</p>
<p>You cannot use fragments of FXG syntax in an MXML file. You must
either use the FXG document as a separate component or convert the
code to MXML graphics syntax.</p>
<p>You can also draw with the ActionScript drawing APIs.</p>
</div>
<div class="nested1" id="WSda78ed3a750d6b8f-237979311225c0987ce-8000_verapache"><a name="WSda78ed3a750d6b8f-237979311225c0987ce-8000_verapache"><!-- --></a>
<h2 class="topictitle2">Graphics classes and elements</h2>
<div>
<p>FXG and MXML graphics share a very similar syntax. The
FXG language includes a set of elements that are defined in the <a href="https://sourceforge.net/adobe/flexsdk/wiki/FXG%202.0%20Specification/" target="_blank">FXG 2.0 specification</a>. MXML graphics include
tags that are defined in the MXML language. FXG can be thought of
as a subset of the MXML graphics tags. </p>
<p>MXML graphics tags are converted to their backing ActionScript
implementations by the MXML compiler. Most FXG tags, on the other
hand, are converted to low-level Flash Player instructions when
compiled. It is this difference that make FXG components much more
highly optimized than MXML graphics. </p>
<div class="p">Most FXG elements are roughly equivalent to an MXML graphics
class of the same name. But, they do not support all the properties
of the MXML graphics class, nor are they backed by ActionScript
classes. The following table shows the FXG 2.0 elements and their
supported attributes and children. In addition, it lists the equivalent
MXML graphics tag:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all">
<thead align="left">
<tr>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e130">
<p>FXG tag</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e136">
<p>Equivalent MXML tag and ActionScript class</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e142">
<p>FXG-supported attributes</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e148">
<p>FXG children</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;BitmapFill&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:BitmapFill&gt;</samp>
</p>
<p>mx.graphics.BitmapFill</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">fillMode
rotation
scaleX
scaleY
source (required)
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;matrix&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;BitmapImage&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:BitmapImage&gt;</samp>
</p>
<p>spark.primitives.BitmapImage</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">alpha
blendMode
fillMode
height
rotation
scaleX
scaleY
source (required)
visible
width
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;ColorTransform&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:ColorTransform&gt;</samp>
</p>
<p>flash.geom.ColorTransform</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">alphaMultiplier
alphaOffset
blueMultiplier
blueOffset
greenMultiplier
greenOffset
redMultiplier
redOffset</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Definition&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;fx:Definition&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">name (required)</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;Group&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Ellipse&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:Ellipse&gt;</samp>
</p>
<p>spark.primitives.Ellipse</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">blendMode
height
rotation
scaleX
scaleY
transformX
transformY
visible
width
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;fill&gt;
&lt;filters&gt;
&lt;mask&gt;
&lt;stroke&gt;
&lt;transform&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;GradientEntry&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:GradientEntry&gt;</samp>
</p>
<p>mx.graphics.GradientEntry</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">alpha
color
ratio</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Graphic&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:Graphic&gt;</samp>
</p>
<p>spark.primitives.Graphic</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">mask
scaleGridBottom
scaleGridLeft
scaleGridRight
scaleGridTop
version
viewHeight
viewWidth</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;Group&gt;
&lt;Library&gt;
&lt;mask&gt;</samp>
</p>
<p>Any subclass of the GraphicElement class</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Group&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:Group&gt;</samp>
</p>
<p>spark.components.Group</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">alpha
blendMode
id
maskType
rotation
scaleGridBottom
scaleGridLeft
scaleGridRight
scaleGridTop
scaleX
scaleY
transformX
transformY
visible
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;filters&gt;
&lt;Group&gt;
&lt;transform&gt;</samp>
</p>
<p>Any subclass of the GraphicElement
class</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Library&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;fx:Library&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>None.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;Definition&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Line&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:Line&gt;</samp>
</p>
<p>spark.primitives.Line</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">alpha
blendMode
id
maskType
rotation
scaleX
scaleY
transformX
transformY
visible
x
xFrom
xTo
y
yFrom
yTo</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;fill&gt;
&lt;filters&gt;
&lt;mask&gt;
&lt;stroke&gt;
&lt;transform&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;LinearGradient&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:LinearGradient&gt;</samp>
</p>
<p>mx.graphics.LinearGradient</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">interpolationMethod
rotation
scaleX
spreadMethod
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;GradientEntry&gt;
&lt;matrix&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;LinearGradientStroke&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:LinearGradientStroke&gt;</samp>
</p>
<p>mx.graphics.LinearGradientStroke</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">caps
interpolationMethod
joints
miterLimit
rotation
scaleMode
scaleX
spreadMethod
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;GradientEntry&gt;
&lt;matrix&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Matrix&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:Matrix&gt;</samp>
</p>
<p>flash.geom.Matrix</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">a
b
c
d
tx
ty</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Path&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:Path&gt;</samp>
</p>
<p>spark.primitives.Path</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">blendMode
data
rotation
scaleX
scaleY
transformX
transformY
visible
winding
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;fill&gt;
&lt;filters&gt;
&lt;mask&gt;
&lt;stroke&gt;
&lt;transform&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;RadialGradient&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:RadialGradient&gt;</samp>
</p>
<p>mx.graphics.RadialGradient</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">focalPointRatio
interpolationMethod
rotation
scaleX
scaleY
spreadMethod
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;GradientEntry&gt;
&lt;matrix&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;RadialGradientStroke&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:RadialGradientStroke&gt;</samp>
</p>
<p>mx.graphics.RadialGradientStroke</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">caps
focalPointRatio
joints
miterLimit
scaleMode
scaleX
scaleY
rotation
spreadMethod
interpolationMethod
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;GradientEntry&gt;
&lt;matrix&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Rect&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:Rect&gt;</samp>
</p>
<p>spark.primitives.Rect</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">blendMode
bottomLeftRadiusX
bottomLeftRadiusY
bottomRightRadiusX
bottomRightRadiusY
height
radiusX
radiusY
rotation
scaleX
scaleY
topLeftRadiusX
topLeftRadiusY
topRightRadiusX
topRightRadiusY
transformX
transformY
visible
width
x
y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;fill&gt;
&lt;filters&gt;
&lt;mask&gt;
&lt;stroke&gt;
&lt;transform&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;SolidColor&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:SolidColor&gt;</samp>
</p>
<p>mx.graphics.SolidColor</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">alpha
color</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;SolidColorStroke&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:SolidColorStroke&gt;</samp>
</p>
<p>mx.graphics.SolidColorStroke</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">alpha
caps
color
joints
miterLimit
pixelHinting
scaleMode
weight</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:RichText&gt;</samp>
</p>
<p>spark.primitives.RichText</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>
<samp class="codeph">alpha
blendMode
height
id
maskType
paddingLeft
paddingRight
paddingTop
paddingBottom
rotation
scaleX
scaleY
transformX
transformY
visible
width
x
y</samp>
</p>
<p>Paragraph and character style attributes</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;br&gt;
&lt;content&gt;
&lt;p&gt;
&lt;span&gt;
&lt;transform&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e130 ">
<p>
<samp class="codeph">&lt;Transform&gt;</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e136 ">
<p>
<samp class="codeph">&lt;s:Transform&gt;</samp>
</p>
<p>mx.geom.Transform</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e142 ">
<p>None.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e148 ">
<p>
<samp class="codeph">&lt;colorTransform&gt;
&lt;matrix&gt;</samp>
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>For complete descriptions of the FXG elements and their supported
attributes, see the <a href="https://sourceforge.net/adobe/flexsdk/wiki/FXG%202.0%20Specification/" target="_blank">FXG 2.0 specification</a>.</p>
</div>
</div>
<div class="nested1" id="WSda78ed3a750d6b8f26c150d412357de3591-8000_verapache"><a name="WSda78ed3a750d6b8f26c150d412357de3591-8000_verapache"><!-- --></a>
<h2 class="topictitle2">FXG</h2>
<div>
<p>FXG is a declarative XML syntax for defining vector graphics
in applications built with Flex. FXG can also be used as an interchange
format with other Adobe tools. FXG closely follows the Flash Player
10 rendering model.</p>
<p>Designers can create vector images using tools such as Adobe<sup>®</sup> Photoshop<sup>®</sup>, Adobe<sup>®</sup> Illustrator<sup>®</sup> and
Adobe<sup>®</sup> Fireworks<sup>®</sup> and
export them as an FXG document. You can then use that FXG document
as a component in your applications.</p>
<div class="p">The following example is an FXG document that draws a filled
rectangle:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/GraphicComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Rect id="rect1" width="200" height="200"&gt;
&lt;fill&gt;
&lt;SolidColor color="#FFFFCC"/&gt;
&lt;/fill&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#660099" weight="2"/&gt;
&lt;/stroke&gt;
&lt;/Rect&gt;
&lt;/Graphic&gt;</pre>
</div>
<p>When using FXG documents as components, you specify the tag to
be the name of the FXG file, just as you would do with an ActionScript
or MXML component.</p>
<div class="p">The following application uses the GraphicComp.fxg file as a
component:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/GraphicCompMain.mxml --&gt;
&lt;s:Application backgroundColor="0xFFFFFF"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;comps:GraphicComp id="graphic1"/&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">FXG documents encapsulate nearly all of their functionality in
a single document. FXG documents cannot reference other FXG documents
or MXML documents. However, they can reference the following external
resources:<ul>
<li>
<p>External bitmap files. For an example that
embeds an external image, see <a href="flx_fxg_fx.html#WS8114D32C-2892-42ed-B230-59A94C7690E1_verapache">Bitmap
graphics</a>.</p>
</li>
<li>
<p>Platform fonts by family name and style name.</p>
</li>
</ul>
</div>
<p>Like MXML graphics, FXG tags have an implicit depth order. The
order in which elements are defined defines their depth. Each tag
is effectively drawn above its previous sibling. Children are drawn
on top of their parents.</p>
<p>Adobe creative tools can be used to convert SVG to FXG.
To do this, open the SVG file in the tool and export it as an FXG
file.</p>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f4c0a1c281225c08354e-8000_verapache"><a name="WSda78ed3a750d6b8f4c0a1c281225c08354e-8000_verapache"><!-- --></a>
<h3 class="topictitle3">FXG syntax</h3>
<div>
<p>The root of an FXG document file is a <samp class="codeph">&lt;Graphic&gt;</samp> tag.
An FXG document can include zero or more containers (such as Group)
and graphic elements, as well as a single library that can include
any number of definitions. </p>
<p>The <samp class="codeph">&lt;Graphic&gt;</samp> tag can only appear once
in an FXG document. While the document cannot contain other <samp class="codeph">&lt;Graphic&gt;</samp> elements,
it can contain other elements such as <samp class="codeph">&lt;Rect&gt;</samp>, <samp class="codeph">&lt;Ellipse&gt;</samp>, <samp class="codeph">&lt;Path&gt;</samp>,
and <samp class="codeph">&lt;BitmapImage&gt;</samp>. The <samp class="codeph">&lt;Graphic&gt;</samp> tag
can also optionally contain a single child <samp class="codeph">&lt;Library&gt;</samp> tag and/or
a single <samp class="codeph">&lt;mask&gt;</samp> tag. These elements must
appear before any other tag. If both are present, then the <samp class="codeph">&lt;Library&gt;</samp> tag
must come first. </p>
<p>You cannot specify an ID for the root <samp class="codeph">&lt;Graphic&gt;</samp> tag
in an FXG document. </p>
<div class="p">FXG documents use the following language namespace:<pre class="codeblock">http://ns.adobe.com/fxg/2008</pre>
</div>
<div class="p">When you create an FXG document, you must also add the <samp class="codeph">version</samp> attribute
to the <samp class="codeph">&lt;Graphic&gt;</samp> root tag. The currently
supported version is 2. For example:<pre class="codeblock">:Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt; </pre>
</div>
<div class="p">To use an FXG document in an application, you treat is as any
other component. In your application, you define a namespace that
matches the location of the FXG document. This namespace definition
includes a prefix. For example:<pre class="codeblock">&lt;s:Application
...
xmlns:comps="comps.*"&gt;</pre>
</div>
<div class="p">You then use that prefix to reference the FXG document as a component;
for example:<pre class="codeblock">&lt;comps:MyGraphicComp id="graphic1"/&gt;</pre>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f-237979311225c0987ce-7fff_verapache"><a name="WSda78ed3a750d6b8f-237979311225c0987ce-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">FXG data types</h4>
<div>
<div class="p">The following table describes the basic data types that
you can use in an FXG document:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all">
<thead align="left">
<tr>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e1234">
<p>Data Type</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e1240">
<p>Description</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1234 ">
<p>angle</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1240 ">
<p>An arbitrary number specified as degrees.
Angles are clockwise.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1234 ">
<p>color</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1240 ">
<p>A numerical RGB specification in hexadecimal
notation. You specify a color by using a pound sign (#) immediately
followed by six hexadecimal characters. You cannot use the 0x notation
that is supported in MXML graphics.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1234 ">
<p>coordinate</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1240 ">
<p>Represents a length in the local coordinate
system that is the given distance from the origin of the local coordinate
system along the relevant axis (the x-axis for x coordinates, the
y-axis for y coordinates).</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1234 ">
<p>identifier</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1240 ">
<p>A text string that matches the regular expression
[A-Za-z][A-Za-z0-9_]*.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1234 ">
<p>integer</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1240 ">
<p>An optional sign character (+ or -) followed
by one or more digits 0 through 9. If the sign character is not
present, the number is non-negative. Unless stated otherwise for
a particular attribute or property, the range for an integer ranges from
-2147483648 to 2147483647.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1234 ">
<p>length</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1240 ">
<p>A distance measurement. The format of a
length is a number.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1234 ">
<p>number</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1240 ">
<p>Specified either in decimal notation, or
in scientific notation. Decimal notation consists of either an integer
or an optional sign character, followed by zero or more digits,
followed by a dot (.), followed by one or more digits. Scientific notation
consists of a decimal-number immediately followed by the letter
"e" or "E" immediately followed by an integer.</p>
<p>Unless stated
otherwise for a particular attribute or property, a number has the
capacity for at least a single-precision floating point number and
has a range of -3.4e+38F to +3.4e+38F.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1234 ">
<p>percentage</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e1240 ">
<p>A number immediately followed by a percentage
sign (%). Percentage values are always relative to another value;
for example, a length. Attributes or properties that allow percentage
values also define the reference distance measurement to which the
percentage refers.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f-237979311225c0987ce-7ffe_verapache"><a name="WSda78ed3a750d6b8f-237979311225c0987ce-7ffe_verapache"><!-- --></a>
<h4 class="topictitle4">Tags not supported by FXG</h4>
<div>
<div class="p">While FXG is syntactically very similar to MXML, FXG does
not define equivalents for all the MXML language tags. It does,
however, include the <samp class="codeph">&lt;Definition&gt;</samp>, <samp class="codeph">&lt;Library&gt;</samp> and <samp class="codeph">&lt;Private&gt;</samp> elements,
which are equivalent to the MXML language tags of the same names.
FXG does not define any other MXML language tags. The MXML language
tags not defined by FXG include the following tags:<ul>
<li>
<p>
<samp class="codeph">&lt;fx:Binding&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Component&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Declaration&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Metadata&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Model&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Reparent&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Repeater&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Script&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:State&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:states&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Style&gt;</samp>
</p>
</li>
</ul>
</div>
<p>FXG syntax also does not include any ActionScript 3.0 built-in
primitive tags. The list of built-in tags that are not defined by
FXG includes the following:</p>
<div class="p">
<ul>
<li>
<p>
<samp class="codeph">&lt;fx:Array&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Boolean&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Class&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Date&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Function&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:int&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Number&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:Object&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:String&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:uint&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:XML&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;fx:XMLList&gt;</samp>
</p>
</li>
</ul>
</div>
<p>FXG does not support data binding. If you try to use the data
binding short-hand syntax in an FXG document, the compiler treats
it as a literal String value.</p>
</div>
</div>
</div>
<div class="nested2" id="WS6A72DBB6-E49E-465f-BAA8-462440405918_verapache"><a name="WS6A72DBB6-E49E-465f-BAA8-462440405918_verapache"><!-- --></a>
<h3 class="topictitle3">Using FXG in applications built
with Flex</h3>
<div>
<p>When you use an FXG document as a component in your application,
the compiler optimizes the document into a subclass of the spark.core.SpriteVisualElement
class. Specifically, the compiler maps the FXG elements to SWF graphics
primitive tags and links only a light-weight, Sprite-based class
into your application.</p>
<p>The SpriteVisualElement class extends the Sprite class. It adds
support for sizing, positioning, and alpha when used in an application
built with Flex.</p>
<p>To use FXG as a component in your applications:</p>
<div class="p">
<ol>
<li>
<p>Store the FXG document in a location where the compiler
can find it. This can be in the same directory as the application,
or in a separate location. If you store the FXG document in a separate
location, you must add the location to the compiler's source path.</p>
</li>
<li>
<p>Declare a namespace for the component. For example, if the
FXG file is in the same directory as the main application that uses
it, you can declare a namespace of "*". If the FXG file is in a
directory called comps, you can declare a namespace of "comps.*".</p>
</li>
<li>
<p>Add a tag in your application that declares the component
inside a Spark container. (You cannot use a MX container as a direct
parent of an FXG component.) You can set DisplayObject properties
on the tag, such as <samp class="codeph">x</samp> and <samp class="codeph">y</samp>, <samp class="codeph">alpha</samp>, <samp class="codeph">height</samp> and <samp class="codeph">width</samp>.
You can also add event handlers that are supported by the SpriteVisualElement
class on the tag.</p>
</li>
</ol>
</div>
<div class="p">The following example creates multiple instances of the star.fxg
component, and sets properties on each of those instances:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/OptimizedFXGExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="*"
width="500" height="300"&gt;
&lt;s:Group&gt;
&lt;comps:star height="100" width="100" x="50" y="50"/&gt;
&lt;comps:star rotationX="20" height="70" width="70" x="150" y="50" alpha=".75"/&gt;
&lt;comps:star rotationX="40" height="50" width="50" x="220" y="50" alpha=".5"/&gt;
&lt;comps:star rotationX="60" height="30" width="30" x="270" y="50" alpha=".3"/&gt;
&lt;comps:star rotationX="80" height="10" width="10" x="300" y="50" alpha=".1"/&gt;
&lt;/s:Group&gt;
&lt;/s:Application&gt; </pre>
</div>
<div class="p">The following is the FXG component that is used by the previous
example:<pre class="noswf">&lt;?xml version='1.0' encoding='UTF-8'?&gt;
&lt;!-- fxg/star.fxg --&gt;
&lt;fxg:Graphic xmlns:fxg="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;fxg:Path x="9.399" y="10.049" data="M 82.016 78.257 L 51.895 69.533 L 27.617 89.351 L 26.621 58.058 L 0.231 41.132 L 29.749 30.52 L 37.714 0.241 L 56.944 24.978 L 88.261 23.181 L 70.631 49.083 Z"&gt;
&lt;fxg:fill&gt;
&lt;fxg:SolidColor color="#FFFFFF"/&gt;
&lt;/fxg:fill&gt;
&lt;fxg:stroke&gt;
&lt;fxg:SolidColorStroke
caps="none"
color="#4769C4"
joints="miter"
miterLimit="4"
weight="20"/&gt;
&lt;/fxg:stroke&gt;
&lt;/fxg:Path&gt;
&lt;/fxg:Graphic&gt; </pre>
</div>
<p>FXG documents use only the *.fxg filename suffix. You cannot
have another file of the same name with an *.mxml or *.as suffix
in the same directory. </p>
<div class="p">You can use ActionScript to instantiate an FXG component. When
you do this, you declare the FXG tag to be of type SpriteVisualElement.
You then add the component to the display list by calling the <samp class="codeph">addElement()</samp> method,
as the following example shows:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/OptimizedFXGActionScriptExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
width="500" height="300"
creationComplete="drawStar()"&gt;
&lt;fx:Script&gt;
&lt;![CDATA[
import spark.core.SpriteVisualElement;
private var myStar:SpriteVisualElement;
private function drawStar():void {
// Create new instances of star.fxg as if it were a local component.
for (var i:int = 0; i&lt;4; i++) {
myStar = new star();
myStar.x = 50 + (i*75);
myStar.y = 50;
myStar.height = 100 - (i*30);
myStar.width = 100 - (i*30);
myStar.alpha = 1 - (i*.2);
myStar.rotationX = 20 + (i*20);
addElement(myStar);
}
}
]]&gt;
&lt;/fx:Script&gt;
&lt;/s:Application&gt; </pre>
</div>
</div>
<div class="nested3" id="WS98F97866-9F8A-4f39-8519-459F584CE9F6_verapache"><a name="WS98F97866-9F8A-4f39-8519-459F584CE9F6_verapache"><!-- --></a>
<h4 class="topictitle4">Generating FXG</h4>
<div>
<p>When you export a graphic file from a tool such as Adobe
Illustrator in the FXG format, the tool writes a *.fxg file with
a <samp class="codeph">&lt;Graphic&gt;</samp> root tag.</p>
<p>If you are given the option to select a version of FXG, select
version 2.</p>
<p>You can ignore the information in the <samp class="codeph">&lt;Private&gt;</samp> code
block, as long as you also leave the its namespace declaration.
The contents of the <samp class="codeph">&lt;Private&gt;</samp> block must
be well-formed and valid XML but is not rendered.</p>
<p>You can optionally remove the <samp class="codeph">&lt;Private&gt;</samp> tag
and its contents from the FXG document. Some tools export FXG with
additional syntax so that the file can be re-edited. An FXG document
exported from Illustrator, for example, includes a <samp class="codeph">&lt;Private&gt;</samp> block
of code that is used by Illustrator if you want to edit the file again.
If you do not expect to edit the file in Illustrator again, then
you can remove the <samp class="codeph">&lt;Private&gt;</samp> block.</p>
</div>
</div>
<div class="nested3" id="WSDAD87261-09E9-4091-8169-F2758607F125_verapache"><a name="WSDAD87261-09E9-4091-8169-F2758607F125_verapache"><!-- --></a>
<h4 class="topictitle4">Converting FXG elements to MXML
graphics</h4>
<div>
<p>In general, you should use an FXG document as a standalone
component in your applications. This gives you the greatest amount
of memory optimization, and lets you reuse your FXG files in other
parts of the same application, or in other applications. In addition,
by keeping the FXG document separate from the application, you can
edit and export the FXG again from a graphics tool. </p>
<p>One disadvantage to using an FXG file as a standalone component
is that you cannot get a reference to individual elements in it.
The FXG component itself is a "black box"; you cannot interact with
individual elements from your application or other components. You
can, however, still apply effects, resize, position, and trigger
events from interaction with the FXG component itself.</p>
<p>In some cases, you might want to add the FXG output directly
into your application. You can do this, but you must convert the
FXG syntax to MXML graphics. </p>
<p>After converting FXG elements to MXML graphics, you can get a
reference to the various graphic elements, just as you can with
any other MXML tags. This is useful if you want to apply special
effects or events to what were previously FXG elements. After you
convert the FXG file to MXML graphics, you cannot re-edit the FXG
file in a graphics tool. It is now part of MXML.</p>
<div class="p">To convert an FXG document to MXML graphics:<ol>
<li>
<p>Start
by copying and pasting the FXG code into your MXML document.</p>
</li>
<li>
<div class="p">Update the namespaces:<ol type="a">
<li>
<p>Change the FXG namespace
(http://ns.adobe.com/fxg/2008) to the Spark component namespace
(library://ns.adobe.com/flex/spark). There can be only one language
namespace per document.</p>
</li>
<li>
<div class="p">If the FXG fragment uses additional tool specific namespaces,
you can add these to the root of the MXML file. For example, FXG
exported from Adobe Illustrator typically includes the following
namespace declarations:<pre class="codeblock">xmlns:ai="http://ns.adobe.com/ai/2008"
xmlns:d="http://ns.adobe.com/fxg/2008/dt"</pre>
</div>
<p>These
namespaces do not impact the rendering of the document, but must be
retained to keep the XML document valid as tool-specific private
attributes will be prefixed in these namespaces.</p>
</li>
</ol>
</div>
</li>
<li>
<p>Change or remove any namespace prefixes on the <samp class="codeph">&lt;Library&gt;</samp>, <samp class="codeph">&lt;Definition&gt;</samp>,
and <samp class="codeph">&lt;Private&gt;</samp> elements. They must use the
MXML 2009 language namespace (http://ns.adobe.com/mxml/2009). If
you remove a namespace prefix on the tag, you can usually just add
the "fx:" prefix to each of these elements.</p>
</li>
<li>
<p>Move the <samp class="codeph">&lt;Library&gt;</samp> tag and any <samp class="codeph">&lt;Definition&gt;</samp> elements
it contains to the top of the MXML document. If there is already
a <samp class="codeph">&lt;fx:Library&gt;</samp> tag in the MXML document,
move just the <samp class="codeph">&lt;Definition&gt;</samp> elements into
it and remove the FXG <samp class="codeph">&lt;Library&gt;</samp> tag. </p>
</li>
<li>
<p>For library definitions, add the "fx:" prefix to their tags
in the body of the MXML file. In MXML 2009 documents, library definitions
are actually in the language namespace. For example, the <samp class="codeph">&lt;fx:Definition name="BlueCircle"&gt;</samp> tag
references to a definition that must also be in the "fx" namespace;
for example, <samp class="codeph">&lt;fx:BlueCircle&gt;</samp>.</p>
</li>
<li>
<p>Move the <samp class="codeph">&lt;Private&gt;</samp> tag to the end
of the MXML document or remove it. You do not need to include the <samp class="codeph">&lt;Private&gt;</samp> tag
at all, but it can contain useful information about the tool that
generated the FXG.</p>
</li>
<li>
<p>Update the namespace prefix of the FXG elements. There is
likely to be an "s:" prefix already mapped to the Spark component
namespace on the MXML document's root tag (xmlns:s="library://ns.adobe.com/flex/spark").
Add the "s:" prefix to all of the FXG graphical elements. For example,
change <samp class="codeph">&lt;Graphic&gt;</samp> to <samp class="codeph">&lt;s:Graphic&gt;</samp>.</p>
</li>
<li>
<p>For FXG 1.0 documents only:</p>
<ol type="a">
<li>
<p>Convert <samp class="codeph">&lt;TextGraphic&gt;</samp> elements
to <samp class="codeph">&lt;s:RichText&gt;</samp>. This does not apply to FXG
2.0 documents, which use the <samp class="codeph">&lt;RichText&gt;</samp> tag.
In that case, you just add the "s:" prefix to the <samp class="codeph">&lt;RichText&gt;</samp> tag
to make it conform to MXML syntax.</p>
</li>
<li>
<p>Convert <samp class="codeph">&lt;BitmapGraphic&gt;</samp> elements to <samp class="codeph">&lt;s:BitmapImage&gt;</samp>.
This does not apply to FXG 2.0 documents, which use the <samp class="codeph">&lt;BitmapImage&gt;</samp> tag.
In that case, you just add the "s:" prefix to the <samp class="codeph">&lt;BitmapImage&gt;</samp> tag
to make it conform to MXML syntax.</p>
</li>
</ol>
</li>
</ol>
</div>
<div class="p">The following file, exported in FXG format from Adobe Illustrator,
includes the private information as well as the <samp class="codeph">&lt;Graphic&gt;</samp> root
tag. The contents of this *.fxg file are being shown so that you
can then see in a subsequent example how the contents are converted
to MXML graphics.<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;!-- assets/skins/SimpleBox.fxg --&gt;
&lt;Graphic version="1.0"
viewHeight="30"
viewWidth="100"
ai:appVersion="14.0.0.367"
d:id="1"
xmlns="http://ns.adobe.com/fxg/2008"
xmlns:ai="http://ns.adobe.com/ai/2008"
xmlns:d="http://ns.adobe.com/fxg/2008/dt"&gt;
&lt;Library/&gt;
&lt;Group
x="-0.296875"
y="-0.5" d:id="2"
d:type="layer"
d:userLabel="Layer 1"&gt;
&lt;Group d:id="3"&gt;
&lt;Rect x="0.5" y="0.5" width="100" height="30" ai:knockout="0"&gt;
&lt;fill&gt;
&lt;LinearGradient x="0.5" y="15.5" scaleX="100" rotation="-0"&gt;
&lt;GradientEntry color="#ffffff" ratio="0"/&gt;
&lt;GradientEntry ratio="1"/&gt;
&lt;/LinearGradient&gt;
&lt;/fill&gt;
&lt;stroke&gt;
&lt;SolidColorStroke
color="#0000ff"
caps="none"
weight="1"
joints="miter"
miterLimit="4"/&gt;
&lt;/stroke&gt;
&lt;/Rect&gt;
&lt;/Group&gt;
&lt;/Group&gt;
&lt;Private&gt;
&lt;ai:PrivateElement d:ref="#1"&gt;
&lt;ai:SaveOptions&gt;
&lt;ai:Dictionary&gt;
&lt;ai:DictEntry name="preserveGradientPolicy" value="3" valueType="Integer"/&gt;
&lt;ai:DictEntry name="rasterizeResolution" value="72" valueType="Integer"/&gt;
&lt;ai:DictEntry name="clipToActiveArtboard" value="1" valueType="Boolean"/&gt;
&lt;ai:DictEntry name="downsampleLinkedImages" value="0" valueType="Boolean"/&gt;
&lt;ai:DictEntry name="preserveFilterPolicy" value="3" valueType="Integer"/&gt;
&lt;ai:DictEntry name="preserveTextPolicy" value="3" valueType="Integer"/&gt;
&lt;ai:DictEntry name="writeImages" value="1" valueType="Boolean"/&gt;
&lt;ai:DictEntry name="includeXMP" value="0" valueType="Boolean"/&gt;
&lt;ai:DictEntry name="aiEditCap" value="1" valueType="Boolean"/&gt;
&lt;ai:DictEntry name="versionKey" value="1" valueType="Integer"/&gt;
&lt;ai:DictEntry name="includeSymbol" value="0" valueType="Boolean"/&gt;
&lt;/ai:Dictionary&gt;
&lt;/ai:SaveOptions&gt;
&lt;ai:DocData base="SimpleBox.assets/images"/&gt;
&lt;ai:Artboards
originOffsetH="0"
originOffsetV="30"
rulerCanvasDiffH="50.5"
rulerCanvasDiffV="-14.5"
zoom="17.17"&gt;
&lt;ai:Artboard active="1" index="0" right="100" top="30"/&gt;
&lt;ai:ArtboardsParam all="0" range="" type="0"/&gt;
&lt;/ai:Artboards&gt;
&lt;/ai:PrivateElement&gt;
&lt;ai:PrivateElement d:ref="#2"&gt;
&lt;ai:LayerOptions colorType="ThreeColor"&gt;
&lt;ai:ThreeColor blue="257" green="128.502" red="79.31"/&gt;
&lt;/ai:LayerOptions&gt;
&lt;/ai:PrivateElement&gt;
&lt;ai:PrivateElement
ai:hashcode="769d7bac08ad6bdcf80f40fca11df6c0"
d:ref="#3"&gt;
&lt;ai:Rect height="30" knockout="0" width="100" x="0.5" y="0.5"&gt;
&lt;ai:Stroke colorType="ThreeColor" miterLimit="4" weight="1"&gt;
&lt;ai:ThreeColor blue="1"/&gt;
&lt;/ai:Stroke&gt;
&lt;ai:Fill colorType="Gradient"&gt;
&lt;ai:Gradient
gradientType="linear"
length="100" originX="0.5"
originY="15.5"&gt;
&lt;ai:GradientStops&gt;
&lt;ai:GradientStop colorType="GrayColor" rampPoint="0"&gt;
&lt;ai:GrayColor/&gt;
&lt;/ai:GradientStop&gt;
&lt;ai:GradientStop colorType="GrayColor" rampPoint="100"&gt;
&lt;ai:GrayColor gray="1"/&gt;
&lt;/ai:GradientStop&gt;
&lt;/ai:GradientStops&gt;
&lt;/ai:Gradient&gt;
&lt;/ai:Fill&gt;
&lt;ai:ArtStyle/&gt;
&lt;/ai:Rect&gt;
&lt;/ai:PrivateElement&gt;
&lt;/Private&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">To convert this example to MXML graphics:<ul>
<li>
<p>Remove the <samp class="codeph">&lt;Library/&gt;</samp> tag.
This example does not contain any <samp class="codeph">&lt;Definition&gt;</samp> elements.</p>
</li>
<li>
<p>Remove the <samp class="codeph">&lt;Private&gt;</samp> block.</p>
</li>
<li>
<p>Move the two Illustrator-specific namespaces to the application's
root tag:</p>
<pre class="codeblock">xmlns:ai="http://ns.adobe.com/ai/2008"
xmlns:d="http://ns.adobe.com/fxg/2008/dt"</pre>
</li>
<li>
<p>Remove the FXG-specific namespace:</p>
<pre class="codeblock">"http://ns.adobe.com/fxg/2008"</pre>
</li>
<li>
<p>Add the "s:" prefix to all elements.</p>
</li>
<li>
<p>Because the "d" and "ai" namespace definitions are intact,
you do not have to remove the attributes specific to these namespaces.
The attributes <samp class="codeph">type</samp> and <samp class="codeph">userLabel</samp>,
for example, appear on the <samp class="codeph">&lt;Group&gt;</samp> tag from
the original FXG file. To further simplify this example, though,
you could remove them because Flex ignores anything in those namespaces. </p>
<p>For
example, this:</p>
<pre class="codeblock">&lt;s:Group x="-0.296875" y="-0.5" d:id="2" d:type="layer" d:userLabel="Layer 1"&gt;</pre>
<div class="p">Becomes
this:<pre class="codeblock">&lt;s:Group x="-0.296875" y="-0.5"&gt;</pre>
</div>
</li>
</ul>
</div>
<div class="p">The following example application contains the converted FXG
from the previous example:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/ResultsMXMLGraphicsApp.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:ai="http://ns.adobe.com/ai/2008"
xmlns:d="http://ns.adobe.com/fxg/2008/dt"&gt;
&lt;s:Graphic version="1.0"
viewHeight="30"
viewWidth="100"
ai:appVersion="14.0.0.367"
d:id="1"&gt;
&lt;s:Group x="-0.296875" y="-0.5" d:id="2" d:type="layer" d:userLabel="Layer 1"&gt;
&lt;s:Group d:id="3"&gt;
&lt;s:Rect x="0.5" y="0.5" width="100" height="30" ai:knockout="0"&gt;
&lt;s:fill&gt;
&lt;s:LinearGradient x="0.5" y="15.5" scaleX="100" rotation="-0"&gt;
&lt;s:GradientEntry color="#ffffff" ratio="0"/&gt;
&lt;s:GradientEntry ratio="1"/&gt;
&lt;/s:LinearGradient&gt;
&lt;/s:fill&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke
color="#0000ff"
caps="none"
weight="1"
joints="miter"
miterLimit="4"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/s:Group&gt;
&lt;/s:Graphic&gt;
&lt;/s:Application&gt;</pre>
</div>
</div>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f590b1ed3123769ce990-8000_verapache"><a name="WSda78ed3a750d6b8f590b1ed3123769ce990-8000_verapache"><!-- --></a>
<h3 class="topictitle3">Coordinate systems</h3>
<div>
<p>FXG defines two coordinate system concepts: the document
coordinate system, and the user coordinate system.</p>
<p>The <em>document coordinate system</em> refers to the coordinate
system of the root tag. By default, its origin sits at the top left
of the document, and extends downward along the positive y axis,
and to the right along the positive x axis. 1 unit corresponds to
1 pixel on the screen.</p>
<p>The <em>user coordinate system</em> refers to the coordinate system
defined on any individual tag in the document. In FXG, the user
coordinate system at the root <samp class="codeph">&lt;Graphic&gt;</samp> tag
is identical to the document coordinate system. </p>
<p>By default, each grouping instance element and graphic element
defines its user coordinate system to be identical to that of its
parent. Any geometry transform defined on the tag (through attributes
or child transform elements) transforms its parent's user coordinate
system into a new system.</p>
<p>All attributes of elements are defined in units of the current
user coordinate system. As a result, the coordinates of the segments
of a path are relative to its coordinate system. To determine the
position of the path segments in document coordinates, you would
multiply its x and y by the geometry transform of the path and each
of its parent elements until you reached the root graphic tag.</p>
<p>Some fills and strokes have their own user coordinate system.
As with Groups, the default coordinate system is aligned with the
coordinate system of their most immediate parent instance. As appropriate,
fills and strokes support geometry transforms that can modify their
coordinate space.</p>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f-7394ba8c12546433d04-8000_verapache"><a name="WSda78ed3a750d6b8f-7394ba8c12546433d04-8000_verapache"><!-- --></a>
<h3 class="topictitle3">Sizing FXG components</h3>
<div>
<p>FXG elements use their <samp class="codeph">height</samp> and <samp class="codeph">width</samp> properties
to determine the size of the graphic. The graphic tag scales to
the values of the <samp class="codeph">height</samp> and <samp class="codeph">width</samp> properties.
The <samp class="codeph">viewWidth</samp> and <samp class="codeph">viewHeight</samp> properties
define the space that the graphic takes up. When you set these values,
the content is not scaled. </p>
<p>If you specify a <samp class="codeph">viewWidth</samp> and <samp class="codeph">viewHeight</samp> that
is larger than the natural size of the content, the graphic takes
up more space than its visual size. The result is a boundary around
the graphic.</p>
<p>You can also specify a <samp class="codeph">viewWidth</samp> and <samp class="codeph">viewHeight</samp> that
is smaller than the natural size of the content. You might do this
if your graphic has chrome such as a border that extends past the
edges of the graphic. In this case, be sure to turn off clipping
in your layout.</p>
</div>
</div>
<div class="nested2" id="WS19f279b149e7481c1ce62b4a12b7ceade98-8000_verapache"><a name="WS19f279b149e7481c1ce62b4a12b7ceade98-8000_verapache"><!-- --></a>
<h3 class="topictitle3">Optimizing FXG</h3>
<div>
<p>Use the techniques described in this section when working
with FXG.</p>
</div>
<div class="nested3" id="WS19f279b149e7481c19e0d29912b7d17c948-8000_verapache"><a name="WS19f279b149e7481c19e0d29912b7d17c948-8000_verapache"><!-- --></a>
<h4 class="topictitle4">Composite path versus rounded rectangle</h4>
<div>
<p>Composite paths create a cleaner look because there are
no extra pixels inside the corners. Rounded rectangles, on the other
hand, have extra pixels due to anti-aliasing. Rounded rectangles
convert to a <samp class="codeph">&lt;Rect&gt;</samp> element in FXG, which
is preferable because a <samp class="codeph">&lt;Rect&gt;</samp> element is
easier to manipulate than a compex path.</p>
</div>
</div>
<div class="nested3" id="WS19f279b149e7481c19e0d29912b7d17c948-7fff_verapache"><a name="WS19f279b149e7481c19e0d29912b7d17c948-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">Move alpha values from the element
to the fill or stroke</h4>
<div>
<p>When exporting FXG files from a graphics editor, the <samp class="codeph">alpha</samp> property
is sometimes placed on the graphic element tag. If you convert the
FXG to MXML, this element uses its own DisplayObject, which can
be computationally expensive. To avoid this, move any <samp class="codeph">alpha</samp> properties
from the element tag down to the stroke or fill. If both the stroke/fill
and the element have <samp class="codeph">alpha</samp> values, multiply the
stroke and fill <samp class="codeph">alpha</samp> values by the element's <samp class="codeph">alpha</samp> value.
For example, if the stroke and element <samp class="codeph">alpha</samp> values
are both .5, then remove the element's <samp class="codeph">alpha</samp> property
and set the stroke's <samp class="codeph">alpha</samp> to .25 (.5 x .5).</p>
</div>
</div>
<div class="nested3" id="WS19f279b149e7481c19e0d29912b7d17c948-7ffe_verapache"><a name="WS19f279b149e7481c19e0d29912b7d17c948-7ffe_verapache"><!-- --></a>
<h4 class="topictitle4">Round alpha values to 2 decimal
places</h4>
<div>
<p>Exported FXG files sometimes use percentage values for <samp class="codeph">alpha</samp> values.
The visual difference between an <samp class="codeph">alpha</samp> value with
two decimal places and a rounded <samp class="codeph">alpha</samp> value is
negligible. To make your code more readable, round off <samp class="codeph">alpha</samp> values
to 2 decimal places. For example, round an <samp class="codeph">alpha</samp> value
of 0.05882352941176471 to 0.06.</p>
</div>
</div>
<div class="nested3" id="WS19f279b149e7481c19e0d29912b7d17c948-7ffd_verapache"><a name="WS19f279b149e7481c19e0d29912b7d17c948-7ffd_verapache"><!-- --></a>
<h4 class="topictitle4">Remove blendMode="normal"</h4>
<div>
<p>By default on graphic elements, the <samp class="codeph">blendMode</samp> is
"auto". When the <samp class="codeph">blendMode</samp> property is "auto",
Flash Player correctly determines whether the element needs to use
the "layer" <samp class="codeph">blendMode</samp> based on the <samp class="codeph">alpha</samp> value.</p>
</div>
</div>
<div class="nested3" id="WS19f279b149e7481c19e0d29912b7d17c948-7ffc_verapache"><a name="WS19f279b149e7481c19e0d29912b7d17c948-7ffc_verapache"><!-- --></a>
<h4 class="topictitle4">Identifying elements of an FXG
file</h4>
<div>
<p>Sometimes it can be hard to look at FXG tags and determine
what that element looks like. An easy way to do this is to copy
your FXG into a <samp class="codeph">&lt;s:Group&gt;</samp> tag in an MXML
application. Then, change the x values of each element so that they
no longer overlap. For example, if your skin is 45 pixels wide and
is comprised of three <samp class="codeph">&lt;Rect&gt;</samp> elements, increase
the <samp class="codeph">x</samp> value of the second <samp class="codeph">&lt;Rect&gt;</samp> by
50 and the third <samp class="codeph">&lt;Rect&gt;</samp> by 100. When you
compile and run the application, you can see each layer spread separately. </p>
<p>An alternative is to toggle the <samp class="codeph">visible</samp> property
of different elements so that you can isolate a particular element.</p>
</div>
</div>
<div class="nested3" id="WS19f279b149e7481c19e0d29912b7d17c948-7ffb_verapache"><a name="WS19f279b149e7481c19e0d29912b7d17c948-7ffb_verapache"><!-- --></a>
<h4 class="topictitle4">Placing shapes with odd stroke
weights (mobile applications only)</h4>
<div>
<p>For a given shape, strokes straddle the shape edges as
opposed to being on the inside or outside of an edge. For example,
take a vertical line starting from 0,0 to 0,100 with a 1-pixel wide
stroke. That stroke stretches in the x-axis from -.5 to .5. However,
because you cannot draw an element at a fractional pixel, Flash
Player draws an anti-aliased line 2 pixels wide to approximate the
fractional position. </p>
<p>This is true only on mobile applications. For desktop applications,
Flash Player pixel-snaps stroke segments.</p>
<p>To counteract this anti-aliasing, place your shapes with odd
numbered stroke weights on a half pixel boundary. For example, place
a <samp class="codeph">&lt;Rect&gt;</samp> with a <samp class="codeph">&lt;SolidColorStroke&gt;</samp> of
weight 1 at 10,10 at 10.5,10.5 instead. </p>
<p>An alternative is to leave all of your stroked shapes at integer
pixels and shift the entire FXG component by .5 in the x and y positions.
If possible, use filled <samp class="codeph">&lt;Rect&gt;</samp> elements in
place of stroked <samp class="codeph">&lt;Rect&gt;</samp> or <samp class="codeph">&lt;Line&gt;</samp> elements.
If you have a <samp class="codeph">&lt;Rect&gt;</samp> element with a fill
and a stroke, try to split it into two filled <samp class="codeph">&lt;Rect&gt;</samp> elements
This technique works only if the fill is completely opaque. If you
have a <samp class="codeph">&lt;Line&gt;</samp> element, try using a filled <samp class="codeph">&lt;Rect&gt;</samp> element
instead. For example, if you have a horizontal <samp class="codeph">&lt;Line&gt;</samp> element,
create a filled <samp class="codeph">&lt;Rect&gt;</samp> element with a height equal
to the <samp class="codeph">&lt;Line&gt;</samp> element's stroke weight.</p>
</div>
</div>
<div class="nested3" id="WS19f279b149e7481c888599e12bb0678285-8000_verapache"><a name="WS19f279b149e7481c888599e12bb0678285-8000_verapache"><!-- --></a>
<h4 class="topictitle4">Reduce anti-aliasing due to stage
quality</h4>
<div>
<p>Mobile applications built in Flex are currently limited
to using <samp class="codeph">StageQuality.MEDIUM</samp>. When designing skins
using FXG and/or programmatic graphics, watch for anti-aliasing
artifacts in rounded corners. The mobile skins mitigate this issue
by using FXG Path data with fills instead strokes to draw curves.</p>
<div class="p">To create the appearance of a rounded rectangle at a 1px stroke
in Fireworks:<ol>
<li>
<p>Draw a filled rounded rectangle.</p>
</li>
<li>
<p>Copy the rectangle, position it 1px down and to the left
of the original rectangle and reduce its width and height by 2px.</p>
</li>
<li>
<p>Select both rectangles, right click and choose Combine Path
&gt; Punch.</p>
</li>
</ol>
</div>
</div>
</div>
<div class="nested3" id="WS19f279b149e7481c19e0d29912b7d17c948-7ffa_verapache"><a name="WS19f279b149e7481c19e0d29912b7d17c948-7ffa_verapache"><!-- --></a>
<h4 class="topictitle4">Use 45 degree angles</h4>
<div>
<p>Try to keep all angles at 45 degrees. This helps to reduce
the visual artifacts from anti-aliasing.</p>
</div>
</div>
</div>
</div>
<div class="nested1" id="WSda78ed3a750d6b8fee1b36612357de97a3-8000_verapache"><a name="WSda78ed3a750d6b8fee1b36612357de97a3-8000_verapache"><!-- --></a>
<h2 class="topictitle2">MXML graphics</h2>
<div>
<p>MXML graphics are a collection of classes that define graphic
elements in an application. MXML graphics tags support interactivity.
They can be children of any container or group, can be declared
as children of the root Application tag, and can be added to the
application's display list.</p>
<p>Most MXML graphics classes are in the mx.graphics and spark.primitives packages.
These classes include shapes, strokes, colors, fills, and gradients. </p>
<p>MXML graphics tags have an implicit depth order. The order in
which elements are defined defines their depth. Each tag is effectively
drawn above its previous sibling. Children are drawn above their
parents.</p>
<div class="p">The following example uses MXML graphics to draw a filled rectangle:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/GraphicCompMainMXML.mxml --&gt;
&lt;s:Application backgroundColor="0xFFFFFF"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;s:Graphic&gt;
&lt;s:Rect id="rect1" width="200" height="200"&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="0xFFFFCC"/&gt;
&lt;/s:fill&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x660099" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Rect&gt;
&lt;/s:Graphic&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">Because the classes that make up MXML graphics are part of the
Flex SDK, you can reference them from within ActionScript or from
other components. The following example changes the rectangle's
color when you click the button:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/ReferenceGraphics.mxml --&gt;
&lt;s:Application backgroundColor="0xFFFFFF"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;s:layout&gt;
&lt;s:VerticalLayout/&gt;
&lt;/s:layout&gt;
&lt;s:Graphic&gt;
&lt;s:Rect id="rect1" width="200" height="200"&gt;
&lt;s:fill&gt;
&lt;s:SolidColor id="sc1" color="0xFFFFCC"/&gt;
&lt;/s:fill&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x660099" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Rect&gt;
&lt;/s:Graphic&gt;
&lt;s:Button label="Change Color" click="sc1.color=0xCCFFFF"/&gt;
&lt;/s:Application&gt;</pre>
</div>
<p>All MXML graphics classes have backing ActionScript implementations.
This means that every MXML tag has a corresponding ActionScript
class that the compiler maps the tag to during compilation. The
table in <a href="flx_fxg_fx.html#WSda78ed3a750d6b8f-237979311225c0987ce-8000_verapache">Graphics
classes and elements</a> lists the tags and their backing ActionScript
classes. You can use the classes in ActionScript directly in your <samp class="codeph">&lt;fx:Script&gt;</samp> blocks
to draw vector based graphics instead of the MXML tags. y</p>
</div>
</div>
<div class="nested1" id="WS5B6A8436-0FF5-4029-8524-C7C1106C483D_verapache"><a name="WS5B6A8436-0FF5-4029-8524-C7C1106C483D_verapache"><!-- --></a>
<h2 class="topictitle2">Paths in FXG and MXML graphics</h2>
<div>
<p>Paths define a filled graphic tag that draws a series of
path segments. In vector graphics, a path is a series of points
connected by straight or curved line segments. Together the lines
form an image. </p>
<p>In FXG, you use a <samp class="codeph">&lt;Path&gt;</samp> tag to define
a vector shape constructed from a set of line segments. The MXML
graphics equivalent of the FXG <samp class="codeph">&lt;Path&gt;</samp> tag
is the <a href="https://flex.apache.org/asdoc/spark/primitives/Path.html" target="_blank">Path</a> class.
In MXML, you use the <samp class="codeph">&lt;s:Path&gt;</samp> tag.</p>
<p>There are several different types of path segments you can use:
line, cubic bezier, and quadratic bezier. Typically, the first tag
of a path definition moves the pen to the starting position of the
graphic. You then use the segments to draw the lines of the graphic. </p>
<p>To define a series of segments in a path, you use the path's <samp class="codeph">data</samp> property.
You pass this property a series of instructions using shorthand
syntax. Each value is preceded by a letter that acts as a segment
identifier. The segment identifier indicates which type of segment
to draw with the numeric values that follow it.</p>
<div class="p">The following table describes the shorthand syntax used by the
Path tag's <samp class="codeph">data</samp> property:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all">
<thead align="left">
<tr>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e2557">
<p>Segment Type</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e2563">
<p>Segment Identifier</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e2569">
<p>Parameters</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e2575">
<p>Example</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Close path</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>
<samp class="codeph">Z/z</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>n/a</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>
<samp class="codeph">Z</samp>
</p>
<p>Closes off the
path.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Cubic Bezier</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>
<samp class="codeph">C/c</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>
<samp class="codeph">c1X c1Y c2X c2Y x y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>
<samp class="codeph">C 45 50 20 30 10 20</samp>
</p>
<p>Curve
to (10, 20), with the first control point at (45, 50) and the second
control point at (20, 30).</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Cubic Bezier (without control points)</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>
<samp class="codeph">S/s</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>
<samp class="codeph">c2X c2Y x y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>S 20 30 10 20</p>
<p>Curve to (10, 20), with
the second control point at (20, 30). The first control point is assumed
to be the reflection of the second control point on the previous
command relative to the current point.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Horizontal line</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>
<samp class="codeph">H/h</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>
<samp class="codeph">x</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>
<samp class="codeph">H 100</samp>
</p>
<p>Horizontal
line to 100.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Line</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>
<samp class="codeph">L/l</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>
<samp class="codeph">x y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>
<samp class="codeph">L 50 30</samp>
</p>
<p>Line to (50,
30).</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Move</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>
<samp class="codeph">M/m</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>
<samp class="codeph">x y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>
<samp class="codeph">M 10 20</samp>
</p>
<p>Move pen
position to (10, 20).</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Quadratic Bezier</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>
<samp class="codeph">Q/q</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>
<samp class="codeph">cX cY x y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>
<samp class="codeph">Q 110 45 90 30</samp>
</p>
<p>Curve
to (90, 30) with the control point at (110, 45).</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Quadratic Bezier (without control points)</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>T/t</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>x y</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>T 90 30</p>
<p>Curve to (90, 30). The control
point is the reflection of the control point on the previous command
relative to the current point.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2557 ">
<p>Vertical line</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2563 ">
<p>
<samp class="codeph">V/v</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2569 ">
<p>
<samp class="codeph">y</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e2575 ">
<p>
<samp class="codeph">V 100</samp>
</p>
<p>Vertical line
to 100.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>You can use an uppercase or lowercase letter for the segment
identifiers. If you specify a segment identifier using the uppercase
letter, then the positioning is absolute. If you specify a segment
identifier using the lowercase letter, then the positioning is relative.</p>
<p>When using segments, you do not need to specify the starting
position of the pen; the x and y coordinate of the starting point
is defined by the current pen position.</p>
<p>After drawing a line segment, the current pen position becomes
the x and y coordinates of the end point of the line. You can use
the Move segment type to reposition the pen without drawing a line.</p>
<p>The Path syntax is nearly identical to the SVG path syntax. This
makes it easy to convert SVG paths to FXG or MXML graphics. There
is one exception: FXG and MXML graphics do not support an "A" or
Arc segment. To create an arc (elliptical, parabolic, or otherwise),
use the the cubic Bezier and quadratic Bezier control points to
achieve any sort of arc.</p>
<p>Paths can contain effects such as transforms, filters, blend
modes, and masks.</p>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f-62cef9891254c0f1978-8000_verapache"><a name="WSda78ed3a750d6b8f-62cef9891254c0f1978-8000_verapache"><!-- --></a>
<h3 class="topictitle3">FXG examples</h3>
<div>
<div class="p">The following example uses the <samp class="codeph">&lt;Path&gt;</samp> tag
to draw a rectangle in FXG:<pre class="codeblock">Ôªø&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimplePathShorthandExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;s:Panel title="Rectangle Example" height="75%" width="75%"&gt;
&lt;comps:SimplePathComp x="10" y="10"/&gt;
&lt;/s:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following is the FXG component that is used by the previous
example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/SimplePathComp.fxg --&gt;
&lt;fx:Graphic xmlns:fx="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Use shorthand syntax to draw the rectangle. --&gt;
&lt;fx:Path data="M 0 0 L 0 100 L 100 100 L 100 0 L 0 0"&gt;
&lt;!-- Define the border color of the rectangle. --&gt;
&lt;fx:stroke&gt;
&lt;fx:SolidColorStroke color="#888888"/&gt;
&lt;/fx:stroke&gt;
&lt;/fx:Path&gt;
&lt;/fx:Graphic&gt;</pre>
</div>
<div class="p">The following example draws two arrows in FXG, one in relative
coordinates and one in absolute coordinates.<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/ArrowExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Arrow Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:HGroup&gt;
&lt;!-- Use the ArrowAbsolute FXG component which uses absolute coordinates. --&gt;
&lt;comps:ArrowAbsolute/&gt;
&lt;!-- Use the ArrowRelative FXG component which uses relative coordinates. --&gt;
&lt;comps:ArrowRelative/&gt;
&lt;/s:HGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines an arrow graphic as an FXG graphic
using absolute coordinates:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/ArrowAbsolute.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Use Use compact syntax with absolute coordinates. --&gt;
&lt;Path data="
M 20 0
C 50 0 50 35 20 35
L 15 35
L 15 45
L 0 32
L 15 19
L 15 29
L 20 29
C 44 29 44 6 20 6"&gt;
&lt;!-- Define the border color of the arrow. --&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#888888"/&gt;
&lt;/stroke&gt;
&lt;!-- Define the fill for the arrow. --&gt;
&lt;fill&gt;
&lt;LinearGradient rotation="90"&gt;
&lt;GradientEntry color="#000000" alpha="0.8"/&gt;
&lt;GradientEntry color="#FFFFFF" alpha="0.8"/&gt;
&lt;/LinearGradient&gt;
&lt;/fill&gt;
&lt;/Path&gt;
&lt;/Graphic&gt; </pre>
</div>
<div class="p">The following file defines an arrow graphic as an FXG graphic
using relative coordinates:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/ArrowRelative.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Use compact syntax with relative coordinates. --&gt;
&lt;Path data="
m 20 0
c 30 0 30 35 0 35
l -5 0
l 0 10
l -15 -13
l 15 -13
l 0 10
l 5 0
c 24 0 24 -23 0 -23"&gt;
&lt;!-- Define the border color of the arrow. --&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#888888"/&gt;
&lt;/stroke&gt;
&lt;!-- Define the fill for the arrow. --&gt;
&lt;fill&gt;
&lt;LinearGradient rotation="90"&gt;
&lt;GradientEntry color="#000000" alpha="0.8"/&gt;
&lt;GradientEntry color="#FFFFFF" alpha="0.8"/&gt;
&lt;/LinearGradient&gt;
&lt;/fill&gt;
&lt;/Path&gt;
&lt;/Graphic&gt; </pre>
</div>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f-62cef9891254c0f1978-7fff_verapache"><a name="WSda78ed3a750d6b8f-62cef9891254c0f1978-7fff_verapache"><!-- --></a>
<h3 class="topictitle3">MXML graphics examples</h3>
<div>
<div class="p">The following MXML graphics example uses the <samp class="codeph">&lt;s:Path&gt;</samp> tag
to draw a rectangle:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimplePathShorthandExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;s:Panel title="Rectangle MXML Graphics Example" height="75%" width="75%"&gt;
&lt;s:Path x="10" y="10" data="M 0 0 L 0 100 L 100 100 L 100 0 L 0 0"&gt;
&lt;!-- Define the border color of the rectangle. --&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x888888"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Path&gt;
&lt;/s:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following MXML graphics example defines two arrows, one with
relative and the other with absolute positioning:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/ArrowExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Arrow MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:HGroup&gt;
&lt;!-- Use absolute coordinates. --&gt;
&lt;s:Graphic&gt;
&lt;!-- Use Use compact syntax with absolute coordinates. --&gt;
&lt;s:Path data="
M 20 0
C 50 0 50 35 20 35
L 15 35
L 15 45
L 0 32
L 15 19
L 15 29
L 20 29
C 44 29 44 6 20 6"&gt;
&lt;!-- Define the border color of the arrow. --&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x888888"/&gt;
&lt;/s:stroke&gt;
&lt;!-- Define the fill for the arrow. --&gt;
&lt;s:fill&gt;
&lt;s:LinearGradient rotation="90"&gt;
&lt;s:GradientEntry color="0x000000" alpha="0.8"/&gt;
&lt;s:GradientEntry color="0xFFFFFF" alpha="0.8"/&gt;
&lt;/s:LinearGradient&gt;
&lt;/s:fill&gt;
&lt;/s:Path&gt;
&lt;/s:Graphic&gt;
&lt;!-- Use relative coordinates. --&gt;
&lt;s:Graphic&gt;
&lt;!-- Use compact syntax with relative coordinates. --&gt;
&lt;s:Path data="
m 20 0
c 30 0 30 35 0 35
l -5 0
l 0 10
l -15 -13
l 15 -13
l 0 10
l 5 0
c 24 0 24 -23 0 -23"&gt;
&lt;!-- Define the border color of the arrow. --&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x888888"/&gt;
&lt;/s:stroke&gt;
&lt;!-- Define the fill for the arrow. --&gt;
&lt;s:fill&gt;
&lt;s:LinearGradient rotation="90"&gt;
&lt;s:GradientEntry color="0x000000" alpha="0.8"/&gt;
&lt;s:GradientEntry color="0xFFFFFF" alpha="0.8"/&gt;
&lt;/s:LinearGradient&gt;
&lt;/s:fill&gt;
&lt;/s:Path&gt;
&lt;/s:Graphic&gt;
&lt;/s:HGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
</div>
</div>
</div>
<div class="nested1" id="WSFAFF6E30-F3D8-4e2b-B69D-C258C5F1FB43_verapache"><a name="WSFAFF6E30-F3D8-4e2b-B69D-C258C5F1FB43_verapache"><!-- --></a>
<h2 class="topictitle2">Libraries and symbols in FXG and
MXML graphics</h2>
<div>
<p>A symbol is a named grouping tag that can be made up of
other symbols and graphic elements. You can define a symbol once
and reuse it any number of times in an FXG document by using the<samp class="codeph"> &lt;Library&gt;</samp> and <samp class="codeph">&lt;Definition&gt;</samp> elements. In
MXML graphics, you use the MXML file's <samp class="codeph">&lt;fx:Library&gt;</samp> and <samp class="codeph">&lt;fx:Definition&gt;</samp> tags. </p>
<p>In FXG, the <samp class="codeph">&lt;Library&gt;</samp> tag contains <samp class="codeph">&lt;Definition&gt;</samp> elements.
The <samp class="codeph">&lt;Library&gt;</samp> tag can only be placed as a
child of the root tag of an FXG document, just as the <samp class="codeph">&lt;fx:Library&gt;</samp> tag
can only be a child of the root tag in an MXML file. Symbols defined
in a library can be referenced by name anywhere in the document. </p>
<p>In FXG, the <samp class="codeph">&lt;Library&gt;</samp> tag must be the
first child of the root tag.</p>
<div class="p">The FXG <samp class="codeph">&lt;Definition&gt;</samp> tag and the MXML <samp class="codeph">&lt;fx:Definition&gt;</samp> tag
can contain only a Group or other symbols. You cannot nest definitions,
as the following example shows:<pre class="codeblock">&lt;!-- This is illegal. --&gt;
&lt;Library&gt;
&lt;Definition name="A"&gt;
&lt;Definition name="B"/&gt;
&lt;/Definition&gt;
&lt;/Library&gt;</pre>
</div>
<div class="p">You can, however, reference symbols inside definitions. Symbols
can be used anywhere a Group can be used, as the following example
shows:<pre class="codeblock">&lt;!-- This is OK. --&gt;
&lt;Library&gt;
&lt;Definition name="A/&gt;
&lt;Definition name="B"&gt;
&lt;A/&gt;
&lt;/Definition&gt;
&lt;/Library&gt;</pre>
</div>
<p>All attributes that are legal on an instance group are also legal
on a symbol.</p>
<p>Libraries can have any number of definitions. Each definition
defines a named symbol that you can reuse in that document. For
example, you can define a rectangle shape in your library, and then
use that rectangle shape any number of times in the document. The
named symbol can optionally contain effects such as color transforms,
filters, blend modes, or masks. These elements can appear in any
order in FXG.</p>
<p>For more information about using the <samp class="codeph">&lt;fx:Library&gt;</samp> and <samp class="codeph">&lt;fx:Definition&gt;</samp> language
tags in MXML, see <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>.</p>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f37378e861254c275c73-8000_verapache"><a name="WSda78ed3a750d6b8f37378e861254c275c73-8000_verapache"><!-- --></a>
<h3 class="topictitle3">FXG examples</h3>
<div>
<div class="p">The following example uses three FXG components. Each component
includes a library definition of an object, and uses that tag multiple
times to make up its shape.<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/LibraryExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Library Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:VGroup&gt;
&lt;comps:YellowShape/&gt;
&lt;comps:BlueShape/&gt;
&lt;comps:RedShape/&gt;
&lt;/s:VGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the YellowShape FXG component used
in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/YellowShape.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Library&gt;
&lt;Definition name="YellowRect"&gt;
&lt;Group&gt;
&lt;Rect height="10" width="10"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight=".5"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;SolidColor color="#FFFF00"/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Group&gt;
&lt;/Definition&gt;
&lt;/Library&gt;
&lt;YellowRect x="0" y="0"/&gt;
&lt;YellowRect x="0" y="12"/&gt;
&lt;YellowRect x="12" y="0"/&gt;
&lt;YellowRect x="12" y="12"/&gt;
&lt;/Graphic&gt;
</pre>
</div>
<div class="p">The following file defines the BlueShape FXG component used in
the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/BlueShape.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Library&gt;
&lt;Definition name="BlueRect"&gt;
&lt;Group&gt;
&lt;Rect height="10" width="10"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight=".5"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;SolidColor color="#66CCFF"/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Group&gt;
&lt;/Definition&gt;
&lt;/Library&gt;
&lt;BlueRect x="0" y="0"/&gt;
&lt;BlueRect x="12" y="0"/&gt;
&lt;BlueRect x="24" y="0"/&gt;
&lt;BlueRect x="36" y="0"/&gt;
&lt;/Graphic&gt;
</pre>
</div>
<div class="p">The following file defines the RedShape FXG component used in
the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/RedShape.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Library&gt;
&lt;Definition name="RedRect"&gt;
&lt;Group&gt;
&lt;Rect height="10" width="10"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight=".5"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;SolidColor color="#FF3333"/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Group&gt;
&lt;/Definition&gt;
&lt;/Library&gt;
&lt;RedRect x="0" y="0"/&gt;
&lt;RedRect x="12" y="0"/&gt;
&lt;RedRect x="12" y="12"/&gt;
&lt;RedRect x="24" y="12"/&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f37378e861254c275c73-7fff_verapache"><a name="WSda78ed3a750d6b8f37378e861254c275c73-7fff_verapache"><!-- --></a>
<h3 class="topictitle3">MXML graphics examples</h3>
<div>
<p>The following example draws three groups of shapes using
MXML graphics that are defined in the library:</p>
<div class="p">
<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/LibraryExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;fx:Library&gt;
&lt;fx:Definition name="YellowRect"&gt;
&lt;s:Group&gt;
&lt;s:Rect height="10" width="10"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="#000000" weight=".5"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="#FFFF00"/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/fx:Definition&gt;
&lt;fx:Definition name="BlueRect"&gt;
&lt;s:Group&gt;
&lt;s:Rect height="10" width="10"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="#000000" weight=".5"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="#66CCFF"/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/fx:Definition&gt;
&lt;fx:Definition name="RedRect"&gt;
&lt;s:Group&gt;
&lt;s:Rect height="10" width="10"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="#000000" weight=".5"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="#FF3333"/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/fx:Definition&gt;
&lt;/fx:Library&gt;
&lt;mx:Panel title="Library MXML Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:VGroup&gt;
&lt;s:Graphic&gt;
&lt;fx:YellowRect x="0" y="0"/&gt;
&lt;fx:YellowRect x="0" y="12"/&gt;
&lt;fx:YellowRect x="12" y="0"/&gt;
&lt;fx:YellowRect x="12" y="12"/&gt;
&lt;/s:Graphic&gt;
&lt;s:Graphic&gt;
&lt;fx:BlueRect x="0" y="0"/&gt;
&lt;fx:BlueRect x="12" y="0"/&gt;
&lt;fx:BlueRect x="24" y="0"/&gt;
&lt;fx:BlueRect x="36" y="0"/&gt;
&lt;/s:Graphic&gt;
&lt;s:Graphic&gt;
&lt;fx:RedRect x="0" y="0"/&gt;
&lt;fx:RedRect x="12" y="0"/&gt;
&lt;fx:RedRect x="12" y="12"/&gt;
&lt;fx:RedRect x="24" y="12"/&gt;
&lt;/s:Graphic&gt;
&lt;/s:VGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
</div>
</div>
</div>
<div class="nested1" id="WSA6ECA359-6528-4f70-A343-B37AF15EF4A9_verapache"><a name="WSA6ECA359-6528-4f70-A343-B37AF15EF4A9_verapache"><!-- --></a>
<h2 class="topictitle2">Groups in FXG and MXML graphics</h2>
<div>
<p>Groups contain content items. In MXML, these items are
typically of type IGraphicElement (the base interface class for
graphic elements), but can also include effects such as the <samp class="codeph">&lt;transform&gt;</samp>, <samp class="codeph">&lt;filters&gt;</samp>, <samp class="codeph">&lt;mask&gt;</samp> elements, and
other <samp class="codeph">&lt;Group&gt;</samp> elements. In MXML graphics,
items inside a group can be any MXML tags.</p>
<p>You define a group in an FXG document by using the <samp class="codeph">&lt;Group&gt;</samp> tag.
In MXML graphics, you use the <samp class="codeph">&lt;s:Group&gt;</samp> tag,
which corresponds to the <a href="https://flex.apache.org/asdoc/spark/components/Group.html" target="_blank">Group</a> class. This
class implements the IGraphicElementContainer interface.</p>
<p>The order of graphical objects inside a group determines their
depth order when rendered. The last object defined in a group is
the top-most tag of the depth order.</p>
<p>A group can be inside a graphic or another group. When a group
is inside a graphic or other group, it is considered an instance
group. Instance groups can optionally contain features such as transforms,
filters, and masks. The order that these children appear does not
matter. Graphical effects such as these are rendered based on a
predefined order, as described in <a href="flx_fxg_fx.html#WSda78ed3a750d6b8f-73a4773012528309923-8000_verapache">Effects</a>.</p>
<p>A Group can also be used inside a definition in the library section.
When a group is inside a definition, it is considered a symbol definition.
Groups inside libraries (symbol definition groups) cannot contain
effects such as masks or transforms.</p>
<p>A group defines a new local coordinate space for its immediate
child elements.</p>
<p>For more information about using the <samp class="codeph">&lt;s:Group&gt;</samp> tag
in MXML, see the <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>.</p>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f36115fe31254c2c5840-8000_verapache"><a name="WSda78ed3a750d6b8f36115fe31254c2c5840-8000_verapache"><!-- --></a>
<h3 class="topictitle3">FXG example</h3>
<div>
<div class="p">The following FXG example uses the YellowShape FXG component:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/GroupCoordinateExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;s:layout&gt;
&lt;s:VerticalLayout/&gt;
&lt;/s:layout&gt;
&lt;mx:Panel title="Group Coordinate Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:YellowShape/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<p>The following file defines the YellowShape FXG component used
in the previous example. The component is defined in a<samp class="codeph"> &lt;Group&gt;</samp> tag
inside a <samp class="codeph">&lt;Library&gt;</samp>, which means it is a symbol
definition group:</p>
<div class="p">
<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/YellowShape.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Library&gt;
&lt;Definition name="YellowRect"&gt;
&lt;Group&gt;
&lt;Rect height="10" width="10"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight=".5"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;SolidColor color="#FFFF00"/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Group&gt;
&lt;/Definition&gt;
&lt;/Library&gt;
&lt;YellowRect x="0" y="0"/&gt;
&lt;YellowRect x="0" y="12"/&gt;
&lt;YellowRect x="12" y="0"/&gt;
&lt;YellowRect x="12" y="12"/&gt;
&lt;/Graphic&gt;
</pre>
</div>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f36115fe31254c2c5840-7fff_verapache"><a name="WSda78ed3a750d6b8f36115fe31254c2c5840-7fff_verapache"><!-- --></a>
<h3 class="topictitle3">MXML graphics example</h3>
<div>
<div class="p">The following MXML graphics example uses the <samp class="codeph">&lt;s:Group&gt;</samp> tag
to define a group of yellow shapes:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/GroupCoordinateExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;fx:Library&gt;
&lt;fx:Definition name="YellowRect"&gt;
&lt;s:Group&gt;
&lt;s:Rect height="10" width="10"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="#000000" weight=".5"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="#FFFF00"/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/fx:Definition&gt;
&lt;/fx:Library&gt;
&lt;mx:Panel title="Group Coordinate MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;fx:YellowRect x="0" y="0"/&gt;
&lt;fx:YellowRect x="0" y="12"/&gt;
&lt;fx:YellowRect x="12" y="0"/&gt;
&lt;fx:YellowRect x="12" y="12"/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
</div>
</div>
</div>
<div class="nested1" id="WS4D7543E0-0BA2-4f5f-92FA-985B6B6315AB_verapache"><a name="WS4D7543E0-0BA2-4f5f-92FA-985B6B6315AB_verapache"><!-- --></a>
<h2 class="topictitle2">Shapes in FXG and MXML graphics</h2>
<div>
<div class="p">FXG and MXML graphics define the following basic shapes:<ul>
<li>
<p>Rectangles</p>
</li>
<li>
<p>Ellipses</p>
</li>
<li>
<p>Lines</p>
</li>
</ul>
</div>
<p>The MXML graphics classes for the basic shapes are defined in
the spark.primitives package.</p>
<p>The default border for any shape is to have a stroke with a line
width of 0. Therefore, you must define a stroke when you draw a
shape, otherwise the shape will be invisible when rendered. You
can optionally fill the shape with a fill.</p>
</div>
<div class="nested2" id="WSA1DB013B-E2C5-4915-8552-E7E9749C4044_verapache"><a name="WSA1DB013B-E2C5-4915-8552-E7E9749C4044_verapache"><!-- --></a>
<h3 class="topictitle3">Rectangles</h3>
<div>
<p>In FXG, the <samp class="codeph">&lt;Rect&gt;</samp> tag draws a rectangular
shape; in MXML graphics, use the <samp class="codeph">&lt;s:Rect&gt;</samp> tag
or the <a href="https://flex.apache.org/asdoc/spark/primitives/Rect.html" target="_blank">spark.primitives.Rect</a> class.
You define the height and width of a rectangle. You can also define
the stroke, or border, of the rectangle, and a fill. </p>
<p>When drawing rectangles, you have a great deal of control over
the curvature of the corners of the rectangle. The FXG <samp class="codeph">&lt;Rect&gt;</samp> tag
and the <samp class="codeph">&lt;s:Rect&gt;</samp> MXML tag class include properties
such as <samp class="codeph">topLeftRadiusX</samp>, <samp class="codeph">topLeftRadiusY</samp>, <samp class="codeph">bottomRightRadiusX</samp>,
and <samp class="codeph">bottomRightRadiusY</samp>. Convenience properties, <samp class="codeph">radiusX</samp> and <samp class="codeph">radiusY</samp>,
let you set the radii of all corners.</p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f-712bd5481254c39b292-8000_verapache"><a name="WSda78ed3a750d6b8f-712bd5481254c39b292-8000_verapache"><!-- --></a>
<h4 class="topictitle4">FXG examples</h4>
<div>
<div class="p">The following FXG example draws a simple rectangle with
a 1 point black stroke:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimpleRectExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Rectangle Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:SimpleRectComp /&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the SimpleRectComp FXG component used
in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/SimpleRectComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Rect height="100" width="200"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="1"/&gt;
&lt;/stroke&gt;
&lt;/Rect&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The following FXG-based example draws two rectangles with strokes
and fills. One rectangle has rounded corners:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/RectExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Rectangle Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:VGroup&gt;
&lt;comps:FilledRectComp/&gt;
&lt;comps:RoundRectComp/&gt;
&lt;/s:VGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the FilledRectComp FXG component used
in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/FilledRectComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Draw rectangle with square corners. --&gt;
&lt;Rect height="100" width="200"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="2"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;RadialGradient&gt;
&lt;GradientEntry color="#0056FF" ratio="0" alpha=".5"/&gt;
&lt;GradientEntry color="#00CC99" ratio=".33" alpha=".5"/&gt;
&lt;GradientEntry color="#ECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/RadialGradient&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Graphic&gt; </pre>
</div>
<div class="p">The following file defines the RoundRectComp FXG component used
in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/RoundRectComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Draw rectangle with rounded corners. --&gt;
&lt;Rect height="100" width="200" radiusX="25" radiusY="25"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="2"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;RadialGradient&gt;
&lt;GradientEntry color="#0056FF" ratio="0" alpha=".5"/&gt;
&lt;GradientEntry color="#00CC99" ratio=".33" alpha=".5"/&gt;
&lt;GradientEntry color="#ECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/RadialGradient&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f-712bd5481254c39b292-7fff_verapache"><a name="WSda78ed3a750d6b8f-712bd5481254c39b292-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics examples</h4>
<div>
<div class="p">The following MXML graphics example draws a simple rectangle
with a 1 point black stroke:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimpleRectExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;mx:Panel title="Rectangle MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;s:Rect height="100" width="200"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="1"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following MXML graphics example draws two rectangles with
strokes and fills. One rectangle has rounded corners:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/RectExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;mx:Panel title="Rectangle MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:VGroup&gt;
&lt;s:Rect height="100" width="200"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:RadialGradient&gt;
&lt;s:GradientEntry color="0x0056FF" ratio="0" alpha=".5"/&gt;
&lt;s:GradientEntry color="0x00CC99" ratio=".33" alpha=".5"/&gt;
&lt;s:GradientEntry color="0xECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/s:RadialGradient&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;s:Rect height="100" width="200" radiusX="25" radiusY="25"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:RadialGradient&gt;
&lt;s:GradientEntry color="0x0056FF" ratio="0" alpha=".5"/&gt;
&lt;s:GradientEntry color="0x00CC99" ratio=".33" alpha=".5"/&gt;
&lt;s:GradientEntry color="0xECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/s:RadialGradient&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:VGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<p>For more information, see the Rect class in the <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>.</p>
</div>
</div>
</div>
<div class="nested2" id="WS4CBB5B4C-D282-4967-A00B-9C1D3BF99DFC_verapache"><a name="WS4CBB5B4C-D282-4967-A00B-9C1D3BF99DFC_verapache"><!-- --></a>
<h3 class="topictitle3">Ellipses</h3>
<div>
<p>In FXG, use the <samp class="codeph">&lt;Ellipse&gt;</samp> tag to
draw circles and ellipses; in MXML graphics, use the <samp class="codeph">&lt;s:Ellipse&gt;</samp> tag
or the <a href="https://flex.apache.org/asdoc/spark/primitives/Ellipse.html" target="_blank">spark.primitives.Ellipse</a> class.</p>
<p>To define the dimensions of the ellipse, use the <samp class="codeph">height</samp> and <samp class="codeph">width</samp> attributes. These
attributes are relative to the graphic's upper left corner. If you
set the <samp class="codeph">height</samp> and <samp class="codeph">width</samp> attributes
to the same value, the ellipse is a circle.</p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f41a80477125508a8131-8000_verapache"><a name="WSda78ed3a750d6b8f41a80477125508a8131-8000_verapache"><!-- --></a>
<h4 class="topictitle4">FXG examples</h4>
<div>
<div class="p">The following FXG-based example draws a simple circle:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimpleEllipseExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Ellipse Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:CircleComp /&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the CircleComp FXG component used
in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/CircleComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Ellipse height="200" width="200"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="1"/&gt;
&lt;/stroke&gt;
&lt;/Ellipse&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The following FXG-based example draws an ellipse with a fill:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/EllipseExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Ellipse Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:FilledCircleComp/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the FilledCircleComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/FilledCircleComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Ellipse height="100" width="250"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="2"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;RadialGradient&gt;
&lt;GradientEntry color="#0056FF" ratio="0" alpha=".5"/&gt;
&lt;GradientEntry color="#00CC99" ratio=".33" alpha=".5"/&gt;
&lt;GradientEntry color="#ECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/RadialGradient&gt;
&lt;/fill&gt;
&lt;/Ellipse&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f41a80477125508a8131-7fff_verapache"><a name="WSda78ed3a750d6b8f41a80477125508a8131-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics examples</h4>
<div>
<div class="p">The following MXML graphics example draws a simple circle:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimpleEllipseExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;mx:Panel title="Ellipse MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;s:Ellipse height="200" width="200"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="1"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Ellipse&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following MXML graphics example draws an ellipse with a fill:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/EllipseExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Ellipse MXML Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;s:Ellipse height="100" width="250"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:RadialGradient&gt;
&lt;s:GradientEntry color="0x0056FF" ratio="0" alpha=".5"/&gt;
&lt;s:GradientEntry color="0x00CC99" ratio=".33" alpha=".5"/&gt;
&lt;s:GradientEntry color="0xECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/s:RadialGradient&gt;
&lt;/s:fill&gt;
&lt;/s:Ellipse&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<p>For more information, see the Ellipse class in the <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>. </p>
</div>
</div>
</div>
<div class="nested2" id="WS2B02873B-74C0-440d-BC8A-C4025EE80F60_verapache"><a name="WS2B02873B-74C0-440d-BC8A-C4025EE80F60_verapache"><!-- --></a>
<h3 class="topictitle3">Lines</h3>
<div>
<p>To draw a line from one point to another in FXG, use the <samp class="codeph">&lt;Line&gt;</samp> tag;
in MXML graphics, use the <samp class="codeph">&lt;s:Line&gt;</samp> tag or
the <a href="https://flex.apache.org/asdoc/spark/primitives/Line.html" target="_blank">spark.primitives.Line</a> class.</p>
<div class="p">The default width of a line is 0; you must define a stroke so
that the line is visible. Strokes can be one of the following:<ul>
<li>
<p>SolidColorStroke</p>
</li>
<li>
<p>LinearGradientStroke</p>
</li>
<li>
<p>RadialGradientStroke</p>
</li>
</ul>
</div>
<p>You can optionally define the color, joint types, and other properties
of the line. </p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f554a70571254c43ab00-8000_verapache"><a name="WSda78ed3a750d6b8f554a70571254c43ab00-8000_verapache"><!-- --></a>
<h4 class="topictitle4">FXG examples</h4>
<div>
<div class="p">The following FXG-based example draws a simple 1 point
black line with the SolidColorStroke child:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimpleLineExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Line Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:LineComp/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the LineComp FXG component used in
the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/LineComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Line xFrom="0" xTo="100" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="1"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The following FXG-based example draws a series of lines with
varying widths:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/LineExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Line Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:MultipleLineComp x="20" y="20"/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the MultipleLineComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/MultipleLineComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Line xFrom="0" xTo="0" yFrom="0" yTo="100"&gt;
&lt;!-- Define the border color of the line. --&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="1" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;Line xFrom="6" xTo="6" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="1" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;Line xFrom="12" xTo="12" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="2" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;Line xFrom="20" xTo="20" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="3" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;Line xFrom="30" xTo="30" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="5" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;Line xFrom="43" xTo="43" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="8" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;Line xFrom="58" xTo="58" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="13" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;Line xFrom="84" xTo="84" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="21" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;Line xFrom="123" xTo="123" yFrom="0" yTo="100"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="34" caps="square"/&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">To use a LinearGradientStroke or RadialGradientStroke in FXG,
you add one or more <samp class="codeph">&lt;GradientEntry&gt;</samp> elements
as children. These gradients are used to define the fill of the
stroke. The following example defines a line whose color shifts
from blue to yellow:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/LinearGradientLineExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Linear Gradient Line Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:LinearGradientLineComp x="20" y="20"/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the LinearGradientLineComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/LinearGradientLineComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Line xFrom="0" xTo="200" yFrom="0" yTo="0"&gt;
&lt;stroke&gt;
&lt;LinearGradientStroke weight="20" caps="square"&gt;
&lt;GradientEntry color="#0056FF" ratio="0" alpha=".5"/&gt;
&lt;GradientEntry color="#ECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/LinearGradientStroke&gt;
&lt;/stroke&gt;
&lt;/Line&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f554a70571254c43ab00-7fff_verapache"><a name="WSda78ed3a750d6b8f554a70571254c43ab00-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics examples</h4>
<div>
<div class="p">The following MXML graphics example draws a simple 1 point
black line with the SolidColorStroke child:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimpleLineExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;mx:Panel title="Line MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;s:Line xFrom="0" xTo="100" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="1"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following MXML graphics example draws a series of lines with
varying widths:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/LineExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Line MXML Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="30" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group x="20" y="20"&gt;
&lt;s:Line xFrom="0" xTo="0" yFrom="0" yTo="100"&gt;
&lt;!-- Define the border color of the line. --&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="1" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;s:Line xFrom="6" xTo="6" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="1" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;s:Line xFrom="12" xTo="12" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="2" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;s:Line xFrom="20" xTo="20" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="3" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;s:Line xFrom="30" xTo="30" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="5" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;s:Line xFrom="43" xTo="43" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="8" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;s:Line xFrom="58" xTo="58" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="13" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;s:Line xFrom="84" xTo="84" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="21" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;s:Line xFrom="123" xTo="123" yFrom="0" yTo="100"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="34" caps="square"/&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">To use a <a href="https://flex.apache.org/asdoc/mx/graphics/LinearGradientStroke.html" target="_blank">LinearGradientStroke</a> or <a href="https://flex.apache.org/asdoc/mx/graphics/RadialGradientStroke.html" target="_blank">RadialGradientStroke</a> in
MXML graphics, you add one or more <samp class="codeph">&lt;s:GradientEntry&gt;</samp> tags
as children. These gradients are used to define the fill of the
stroke. The following MXML graphics example defines a line whose
color shifts from blue to yellow:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/LinearGradientLineExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Linear Gradient Line MXML Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group x="20" y="20"&gt;
&lt;s:Line xFrom="0" xTo="200" yFrom="0" yTo="0"&gt;
&lt;s:stroke&gt;
&lt;s:LinearGradientStroke weight="20" caps="square"&gt;
&lt;s:GradientEntry color="0x0056FF" ratio="0" alpha=".5"/&gt;
&lt;s:GradientEntry color="0xECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/s:LinearGradientStroke&gt;
&lt;/s:stroke&gt;
&lt;/s:Line&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<p>For more information, see the Line class in the <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>.</p>
</div>
</div>
</div>
</div>
<div class="nested1" id="WS4C9DCBEF-6671-47e9-BBC1-F2676529A30A_verapache"><a name="WS4C9DCBEF-6671-47e9-BBC1-F2676529A30A_verapache"><!-- --></a>
<h2 class="topictitle2">Text in FXG and MXML graphics</h2>
<div>
<p>Text is rendered as a graphic element similar to paths
and shapes, but with a restricted subset of rendering options. Text
elements are always rendered using a solid fill color, modified
by any opacity, blend mode, and color transformation defined by
parent elements, and clipped to any clipping content defined on
its parent elements. Text content is only filled, not stroked.</p>
<p>To use text in an FXG 2.0 document, use the <samp class="codeph">&lt;RichText&gt;</samp> tag.
In FXG 1.0, use the <samp class="codeph">&lt;TextGraphic&gt;</samp> tag.</p>
<p>In MXML, you can use the <a href="https://flex.apache.org/asdoc/spark/components/RichText.html" target="_blank">RichText</a>, <a href="https://flex.apache.org/asdoc/spark/components/RichEditableText.html" target="_blank">RichEditableText</a>,
or <a href="https://flex.apache.org/asdoc/spark/components/Label.html" target="_blank">Label</a> classes
to render text. For more information on using text controls in MXML,
see <a href="flx_textcontrols_tc.html#WS2db454920e96a9e51e63e3d11c0bf69084-7d84_verapache">MX
text controls</a>.</p>
<div class="p">In FXG, the <samp class="codeph">&lt;RichText&gt;</samp> tag supports the
following child elements:<ul>
<li>
<p>
<samp class="codeph">&lt;content&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;transform&gt;</samp>
</p>
</li>
</ul>
</div>
<div class="p">To specify text in a <samp class="codeph">&lt;RichText&gt;</samp> tag, you
use a single <samp class="codeph">&lt;content&gt;</samp> child tag. The following
FXG-based example shows several methods of using text in a <samp class="codeph">&lt;RichText&gt;</samp> tag:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/FXGRichTextExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*" height="100%" width="100%"&gt;
&lt;mx:Panel title="RichText Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:HGroup&gt;
&lt;s:Group&gt;
&lt;comps:TextComp/&gt;
&lt;/s:Group&gt;
&lt;s:Group&gt;
&lt;comps:JustifiedTextComp/&gt;
&lt;/s:Group&gt;
&lt;s:Group&gt;
&lt;comps:FormattedTextComp/&gt;
&lt;/s:Group&gt;
&lt;/s:HGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the TextComp FXG component used in
the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/TextComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;RichText&gt;
&lt;content&gt;Hello World!&lt;/content&gt;
&lt;/RichText&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The following file defines the JustifiedTextComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/JustifiedTextComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;RichText textAlign="justify" width="100"&gt;
&lt;content&gt;This is a block of text that is justified, so you can see formatting applied.&lt;/content&gt;
&lt;/RichText&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The following file defines the FormattedTextComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/FormattedTextComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;RichText&gt;
&lt;content&gt;This text is &lt;span fontWeight="bold"&gt;BOLD&lt;/span&gt;,&lt;br/&gt;
this text is &lt;span textDecoration="underline"&gt;UNDERLINED&lt;/span&gt;,&lt;br/&gt;
and this text is &lt;span fontStyle="italic"&gt;ITALIC&lt;/span&gt;.
&lt;p&gt;This is a new paragraph.&lt;/p&gt;&lt;/content&gt;
&lt;/RichText&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The <samp class="codeph">&lt;content&gt;</samp> child tag supports the following
child elements:<ul>
<li>
<p>
<samp class="codeph">&lt;p&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;span&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;br&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;tcy&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;a&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;img&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;tab&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;linkNormalFormat&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;linkHoverFormat&gt;</samp>
</p>
</li>
<li>
<p>
<samp class="codeph">&lt;linkActiveFormat&gt;</samp>
</p>
</li>
</ul>
</div>
<p>The <samp class="codeph">&lt;content&gt;</samp> child tag can also take
raw text.</p>
<p>If you do not explicitly use a <samp class="codeph">&lt;p&gt;</samp> tag
as the first tag in a <samp class="codeph">&lt;content&gt;</samp> tag, then
it is implied. </p>
<div class="p">If you apply style attributes to the <samp class="codeph">&lt;RichText&gt;</samp> tag
(such as <samp class="codeph">fontFamily="arial"</samp>), then the <samp class="codeph">&lt;span&gt;</samp> tag
is implied on the content of the <samp class="codeph">&lt;RichText&gt;</samp> tag.
The following example has multiple text formats, with one implied
span and one explicit span:<pre class="codeblock">&lt;RichText fontFamily="Verdana" fontWeight="bold"&gt;
&lt;content&gt;Hello, &lt;span fontWeight="normal"&gt;World&lt;/span&gt;&lt;/content&gt;
&lt;/RichText&gt;</pre>
</div>
<p>The contents of the <samp class="codeph">&lt;RichText&gt;</samp> tag support
a set of style attributes that define formatting. These styles are
a subset of the MXML RichText class. Some styles are applied at
the character and paragraph level, and some are applied at the container
level. Container-level attributes (whose level is listed as including <samp class="codeph">&lt;RichText&gt;</samp>),
affect the entire text flow when applied to the container. Paragraph-level
attributes (whose level is listed as including <samp class="codeph">&lt;p&gt;</samp>),
affect the paragraph when applied to a <samp class="codeph">&lt;p&gt;</samp> tag.
And character-level attributes (whose level is listed as including <samp class="codeph">&lt;span&gt;</samp>)
affect only the current span when applied to a <samp class="codeph">&lt;span&gt;</samp> tag.</p>
<div class="p">The following table describes the formatting attributes supported
by FXG:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all">
<thead align="left">
<tr>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e4036">
<p>Attribute</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e4042">
<p>Description</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e4048">
<p>Level</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">alignmentBaseline</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Specifies which of the baselines of the
line containing the element the <samp class="codeph">dominantBaseline</samp> snaps
to, thus determining the vertical position of the element in the
line. </p>
<p>The default value is <samp class="codeph">useDominantBaseline</samp>.</p>
<p>Valid
values are <samp class="codeph">roman</samp>, <samp class="codeph">ascent</samp>, <samp class="codeph">descent</samp>, <samp class="codeph">ideographicTop</samp>, <samp class="codeph">ideographicCenter</samp>, <samp class="codeph">ideographicBottom</samp>,
and <samp class="codeph">useDominantBaseline</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">backgroundAlpha</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Alpha (transparency) value for the background.
A value of 0 is fully transparent, and a value of 1 is fully opaque. </p>
<p>The
default value is 1.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">backgroundColor</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Background color of the text. Can be either <samp class="codeph">transparent</samp>,
or an integer containing three 8-bit RGB components. </p>
<p>The
default value is <samp class="codeph">transparent</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">baselineShift</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Indicates the baseline shift for the element
in pixels. The element is shifted perpendicular to the baseline
by this amount. In horizontal text, a positive baseline shift moves
the element up and a negative baseline shift moves the element down.</p>
<p>The
default value is 0.0, indicating no shift. </p>
<p>A value of <samp class="codeph">superscript</samp> shifts
the text up by an amount specified in the font, and applies a transform
to the <samp class="codeph">fontSize</samp> also based on preferences in the
font. </p>
<p>A value of <samp class="codeph">subscript</samp> shifts the text
down by an amount specified in the font, and also transforms the <samp class="codeph">fontSize</samp>. </p>
<p>A
percent value shifts the text by a percentage of the <samp class="codeph">fontSize</samp> attribute.
The minimum/maximum percent are -1000%/1000%.</p>
<p>A Number shifts
the text by that number of pixels. The minimum/maximum Number values
are -1000/1000.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">blockProgression</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Controls the direction in which lines are
stacked. In Latin text, this is <samp class="codeph">tb</samp>, because lines
start at the top and proceed downward. In vertical Chinese or Japanese,
this is <samp class="codeph">rl</samp>, because lines should start at the right
side of the container and proceed leftward.</p>
<p>Valid values are <samp class="codeph">tb</samp> and <samp class="codeph">rl</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">breakOpportunity</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Controls where a line can legally break.
Valid values are <samp class="codeph">auto</samp>, <samp class="codeph">any</samp>, <samp class="codeph">none</samp>, or <samp class="codeph">all</samp>.</p>
<p>A
value of <samp class="codeph">auto</samp> means line breaking opportunities
are based on standard Unicode character properties, such as breaking
between words and on hyphens. </p>
<p>A value of <samp class="codeph">any</samp> indicates
that the line may end at any character. This value is typically
used when Roman text is embedded in Asian text and it is desirable
for breaks to happen in the middle of words. </p>
<p>A value of <samp class="codeph">none</samp> means
that no characters in the range are treated as line break opportunities. </p>
<p>A
value of <samp class="codeph">all</samp> means that all characters in the range
are treated as mandatory line break opportunities; this results
in one character per line. </p>
<p>The default value is <samp class="codeph">auto</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">color</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Sets the color of the text. </p>
<p>The default
value is 0x000000.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">columnCount</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the number of columns in the RichText
element. The column number overrides the other column settings. </p>
<p>The
value can be an Integer, or <samp class="codeph">auto</samp> if unspecified.
If it's an integer, the range of legal values is 0 to 50. If <samp class="codeph">columnCount</samp> is
not specified, but <samp class="codeph">columnWidth</samp> is, then <samp class="codeph">columnWidth</samp> is
used to create as many columns as can fit in the container. </p>
<p>The
default value is <samp class="codeph">auto</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">columnGap</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines th space between columns in pixels.
Does not include space before the first column or after the last
column. Use the padding properties to define that. </p>
<p>Legal
values range from 0 to 1000. </p>
<p>The default value is 0. </p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">columnWidth</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the width of columns in pixels.
If you specify the width of the columns, but not the count, Flex
creates as many columns of that width as possible given the the
container width and <samp class="codeph">columnGap</samp> settings. Any remainder
space is left after the last column. </p>
<p>Legal values are 0 to
8000. </p>
<p>The default value is <samp class="codeph">auto</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">digitCase</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the case for digits.</p>
<p>Valid
values are <samp class="codeph">default</samp>, <samp class="codeph">lining</samp>, and <samp class="codeph">oldStyle</samp>.</p>
<p>A
value of <samp class="codeph">default</samp> uses the normal digit case from
the font. </p>
<p>A value of <samp class="codeph">lining</samp> uses the lining
digit case from the font. </p>
<p>A value of <samp class="codeph">oldStyle</samp> uses
the old style digit case from the font. </p>
<p>The default value
is <samp class="codeph">default</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">digitWidth</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Specifies how wide digits will be when the
text is set. </p>
<p>Valid values are <samp class="codeph">proportional</samp>, <samp class="codeph">tabular</samp>,
and <samp class="codeph">default</samp>.</p>
<p>A value of <samp class="codeph">proportional</samp> means
that the proportional widths from the font are used, and different
digits will have different widths. </p>
<p>A value of <samp class="codeph">tabular</samp> means
that every digits has the same width. </p>
<p>A value of <samp class="codeph">default</samp> means
that the normal width from the font is used. </p>
<p>The default
value is <samp class="codeph">default</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">direction</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Controls the dominant writing direction
for the paragraphs (left-to-right or right-to-left), and how characters
with no implicit writing direction, such as punctuation, are treated. </p>
<p>Valid
values are <samp class="codeph">ltr</samp> and <samp class="codeph">rtl</samp>.</p>
<p>The
default value is <samp class="codeph">ltr</samp>. </p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">dominantBaseline</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Specifies which of the baselines of the
element snaps to the alignmentBaseline to determine the vertical
position of the element on the line. </p>
<p>Valid values are <samp class="codeph">auto</samp>, <samp class="codeph">roman</samp>, <samp class="codeph">ascent</samp>, <samp class="codeph">descent</samp>, <samp class="codeph">ideographicTop</samp>, <samp class="codeph">ideographicCenter</samp>,
and <samp class="codeph">ideographicBottom</samp>.</p>
<p>A value of <samp class="codeph">auto</samp> gets
resolved based on the <samp class="codeph">textRotation</samp> of the span and
the locale of the parent paragraph. A <samp class="codeph">textRotation</samp> of <samp class="codeph">rotate270</samp> resolves
to <samp class="codeph">ideographicCenter</samp>. A locale of Japanese ("ja")
or Chinese ("zh-XX", "zh_XX", etc), resolves to <samp class="codeph">ideographicCenter</samp>,
whereas all others are resolved to <samp class="codeph">roman</samp>. </p>
<p>The
default value is <samp class="codeph">auto</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">firstBaselineOffset</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Specifies the position of the first line
of text in the container (first in each column) relative to the
top of the container. The first line may appear at the position
of the line's ascent, or below by the <samp class="codeph">lineHeight</samp> of
the first line. Or it may be offset by a pixel amount. </p>
<p>Valid
values are <samp class="codeph">auto</samp>, <samp class="codeph">ascent</samp>, <samp class="codeph">lineHeight</samp>,
and a Number.</p>
<p>The default value (auto) specifies that the
line top be aligned to the container top inset. The baseline that
this property refers to is deduced from the container's locale as
follows: <samp class="codeph">ideographicBottom</samp> for Chinese and Japanese
locales, <samp class="codeph">roman</samp> otherwise. </p>
<p>Minumum/maximum
values are 0/1000. </p>
<p>The default value is <samp class="codeph">auto</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">fontFamily</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the font family name used to render
the text. </p>
<p>The font depends on the glyphs that are being rendered
and the fonts that are available on the client system.</p>
<p>For
most platforms, the default value is Arial.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">fontSize</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Sets the size of the glyphs that are used
to render the text, specified in point sizes. </p>
<p>The default
value is 12. The minimum value is 1. The maximum value is 500.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">fontStyle</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Italicizes text. Valid values are <samp class="codeph">normal</samp> and <samp class="codeph">italic</samp>. </p>
<p>The
default value is <samp class="codeph">normal</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">fontWeight</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Bolds text. Valid values are <samp class="codeph">normal</samp> and <samp class="codeph">bold</samp>.</p>
<p>The
default value is <samp class="codeph">normal</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">justificationRule</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the justifier. </p>
<p>A value of <samp class="codeph">eastAsian</samp> enables
justification for Japanese. </p>
<p>The default value is <samp class="codeph">auto</samp>.
A value of <samp class="codeph">auto</samp> is resolved based on the locale of
the paragraph. </p>
<p>Values for Japanese ("ja") and Chinese ("zh-XX",
"zh_XX", etc) resolve to <samp class="codeph">eastAsian</samp>, while all other
locales resolve to space.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">justificationStyle</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the justification style.</p>
<p>A
value of <samp class="codeph">auto</samp> is resolved based on the locale of
the paragraph. Currently, all locales resolve to <samp class="codeph">pushInKinsoku</samp>,
however, this value is only used in conjunction with a <samp class="codeph">justificationRule</samp> value
of <samp class="codeph">eastAsian</samp>, so is only applicable to "ja" and
all "zh" locales. </p>
<p>A value of <samp class="codeph">prioritizeLeastAdjustment</samp> bases
justification on either expanding or compressing the line, whichever
gives a result closest to the desired width. </p>
<p>A value of <samp class="codeph">pushInKinsoku</samp> bases
justification on compressing kinsoku at the end of the line, or
expanding it if there is no kinsoku or if that space is insufficient. </p>
<p>A
value of <samp class="codeph">pushOutOnly</samp> bases justification on expanding
the line. </p>
<p>Valid values are <samp class="codeph">auto</samp>, <samp class="codeph">prioritizeLeastAdjustment</samp>, <samp class="codeph">pushInKinsoku</samp>,
and <samp class="codeph">pushOutOnly</samp>.</p>
<p>The default value is <samp class="codeph">auto</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">kerning</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Applies pair kerning to text. </p>
<p>Valid
values are <samp class="codeph">on</samp>, <samp class="codeph">off</samp>, and <samp class="codeph">auto</samp>.</p>
<p>If <samp class="codeph">on</samp>,
pair kerns are honored. If <samp class="codeph">off</samp>, there is no font-based
kerning applied. If <samp class="codeph">auto</samp>, kerning is applied to
all characters except Kanji, Hiragana or Katakana. </p>
<p>The default
value is <samp class="codeph">auto</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">leadingModel</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Specifies the leading basis (baseline to
which the <samp class="codeph">lineHeight</samp> property refers) and the leading
direction (which determines whether the <samp class="codeph">lineHeight</samp> property
refers to the distance of a line's baseline from that of the line
before it or the line after it). </p>
<p>The default value is <samp class="codeph">auto</samp> which
is resolved based on locale. Locale values of Japanese ("ja") and
Chinese ("zh-XX", "zh_XX", etc) resolve auto to ideographicTopDown
and other locales resolve to romanUp.</p>
<p>Valid values are <samp class="codeph">auto</samp>, <samp class="codeph">romanUp</samp>, <samp class="codeph">ideographicTopUp</samp>, <samp class="codeph">ideographicCenterUp</samp>, <samp class="codeph">ascentDescentUp</samp>, <samp class="codeph">ideographicTopDown</samp>,
and <samp class="codeph">ideographicCenterDown</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">ligatureLevel</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Controls which ligatures in the font will
be used. </p>
<p>Valid values are <samp class="codeph">minimum</samp>, <samp class="codeph">common</samp>, <samp class="codeph">uncommon</samp>,
and <samp class="codeph">exotic</samp>.</p>
<p>A value of <samp class="codeph">minimum</samp> turns
on rlig, <samp class="codeph">common</samp> is rlig + clig + liga; <samp class="codeph">uncommon</samp> is
rlig + clig + liga + dlig; <samp class="codeph">exotic</samp> is rlig + clig
+ liga + dlig + hlig. </p>
<p>You cannot turn the various ligature
features on independently. </p>
<p>The default value is <samp class="codeph">common</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">lineBreak</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Determines whether the text wraps the lines
at the edge of the enclosing <samp class="codeph">&lt;RichText&gt;</samp> element.
Set to <samp class="codeph">toFit</samp> to wrap the lines. Set to <samp class="codeph">explicit</samp> to
break the lines only at a Unicode line end character (such as a
newline or line separator).</p>
<p>Valid values are <samp class="codeph">toFit</samp> and <samp class="codeph">explicit</samp>.</p>
<p>The
default value is <samp class="codeph">toFit</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">lineHeight</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the leading, or the distance from
the previous line's baseline to the current line, in points. This
can be specified in absolute pixels, or as a percentage of the point
size. </p>
<p>The default value is 120%. The minimum value for percent
or number is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">lineThrough</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Whether to apply a strike through to the
text. Set to <samp class="codeph">true</samp> to apply a line through the text;
otherwise set to <samp class="codeph">false</samp>. </p>
<p>The default value
is <samp class="codeph">false</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">locale</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the locale of the text. This controls
case transformations and shaping. Standard locale identifiers as
described in Unicode Technical Standard #35 are used. For example
en, en_US and en-US are all English, ja is Japanese. </p>
<p>Locale
applied at the paragraph and higher level impacts resolution of "auto"
values for <samp class="codeph">dominantBaseline</samp>, <samp class="codeph">justificationRule</samp>, <samp class="codeph">justificationStyle</samp> and <samp class="codeph">leadingModel</samp>. </p>
<p>See
individual attributes for resolution values.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">marginBottom</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the space after the paragraph. As
in CSS, adjacent vertical space collapses. No margin is necessary
if the paragraph falls at the bottom of the <samp class="codeph">&lt;RichText&gt;</samp> tag. </p>
<p>The
default value is 0. The minimum value is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">marginLeft</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the indentation applied to the left
edge of the <samp class="codeph">&lt;RichText&gt;</samp> tag, measured in pixels.</p>
<p>The
default value is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">marginRight</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the indentation applied to the right
edge of the <samp class="codeph">&lt;RichText&gt;</samp> tag, measured in pixels. </p>
<p>The
default value is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">marginTop</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the space before the paragraph.
As in CSS, adjacent vertical space collapses. Given two adjoining
paragraphs (A, B), where A has <samp class="codeph">marginBottom</samp> 12
and B has <samp class="codeph">marginBottom</samp> 24, the total space between
the paragraphs is 24, the maximum of the two, and not 36, the sum.
If the paragraph is at the top of the column, no extra space is
left for the margin.</p>
<p>The default value is 0. The minimum value
is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">paddingBottom</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the inset from bottom edge to content
area, in pixels.</p>
<p>The default value is 0. The minumum/maximum
values are 0/1000.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">paddingLeft</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the inset from left edge to content
area, in pixels.</p>
<p>The default value is 0. The minumum/maximum
values are 0/1000.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">paddingRight</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the inset from right edge to content
area, in pixels.</p>
<p>The default value is 0. The minumum/maximum
values are 0/1000.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">paddingTop</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the inset from top edge to content
area, in pixels.</p>
<p>The default value is 0. The minumum/maximum
values are 0/1000.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">paragraphEndIndent</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the indentation applied to the end
edge of a paragraph (right edge if direction is ltr, left edge otherwise). </p>
<p>Measured
in pixels. Legal values range from 0 to 1000. </p>
<p>Default is
0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">paragraphSpaceAfter</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the amount of whitespace that appears
the paragraph. As in CSS, adjacent vertical space collapses (see
note for paragraphSpaceBefore ). No "space after" is necessary if
the paragraph falls at the bottom of the RichText. </p>
<p>Legal
values range from 0 to 1000. </p>
<p>The default value is 0. The
minimum value is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">paragraphSpaceBefore</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Specifies the amount of whitespace that
appears above a paragraph. As in CSS, adjacent vertical space collapses.
For two adjoining paragraphs (A, B), where A has paragraphSpaceAfter
12 and B has paragraphSpaceBefore 24, the total space between the
paragraphs will be 24, the maximum of the two, and not 36, the sum.
If the paragraph comes at the top of the column, no extra space
is left before it.</p>
<p>Legal values range from 0 to 1000. </p>
<p>The
default value is 0. The minimum value is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">paragraphStartIndent</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines the indentation applied to the start
edge of the paragraph (left edge if direction is ltr, right edge
otherwise). </p>
<p>Measured in pixels. </p>
<p>Legal values range
from 0 to 1000. </p>
<p>The default value is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">tabStops</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Defines an array of tab stops. For more
information, see the <a href="https://sourceforge.net/adobe/flexsdk/wiki/FXG%202.0%20Specification/" target="_blank">FXG 2.0 Specification</a>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">textAlpha</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Sets the opacity level of the text, ranging
from 0 (completely transparent) to 1 (completely opaque). </p>
<p>The
default value is 1.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">textAlign</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Aligns text relative to the text box edges.
Valid values are <samp class="codeph">left</samp>, <samp class="codeph">right</samp>, <samp class="codeph">center</samp>,
and <samp class="codeph">justify</samp>.</p>
<p>The default value is <samp class="codeph">left</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">textAlignLast</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Aligns the last line of the paragraph. </p>
<p>To
make a paragraph set all lines justified, set the <samp class="codeph">textAlign</samp> and <samp class="codeph">textAlignLast</samp> attributes
to <samp class="codeph">justify</samp>. </p>
<p>Valid values are <samp class="codeph">left</samp>, <samp class="codeph">center</samp>, <samp class="codeph">right</samp>,
and <samp class="codeph">justify</samp>.</p>
<p>The default value is <samp class="codeph">left</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">textDecoration</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Underlines text. Valid values are <samp class="codeph">none</samp> and <samp class="codeph">underline</samp>.</p>
<p>The
default value is <samp class="codeph">none</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">textIndent</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Indent the first line of text in a paragraph.
The indent is relative to the left margin. Measured in pixels. </p>
<p>The
default value is 0. This attribute can be negative.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">textJustify</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Applies when <samp class="codeph">justificationRule</samp> is
space. A value of <samp class="codeph">interWord</samp> spreads justification
space out to spaces in the line. A value of <samp class="codeph">distribute</samp> spreads
it out to letters as well as spaces.</p>
<p>The default value is <samp class="codeph">interWord</samp>.</p>
<p>Valid
values are <samp class="codeph">interWord</samp> and <samp class="codeph">distribute</samp>. </p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp> or <samp class="codeph">&lt;p&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">textRotation</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Controls the rotation of the text, in ninety
degree increments. </p>
<p>Valid values are <samp class="codeph">auto</samp>, <samp class="codeph">rotate0</samp>, <samp class="codeph">rotate90</samp>, <samp class="codeph">rotate180</samp>,
and <samp class="codeph">rotate270</samp>. </p>
<p>The default value is <samp class="codeph">auto</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">trackingLeft</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Adds space to the left of each character.
Can be a percent value or a Number.</p>
<p>A Number tracks by a pixel
amount, with the minimum/maximum values -100/1000.</p>
<p>A percent
value is the percentage of the <samp class="codeph">fontSize</samp> attribute.
Legal values for percentages are -100% to 1000%. </p>
<p>Negative
values bring characters closer together. </p>
<p>The default value
is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">trackingRight</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Adds space to the right of each character.
Can be a percent value or a Number.</p>
<p>A Number tracks by a pixel
amount, with the minimum/maximum values -100/1000.</p>
<p>A percent
value is the percentage of the <samp class="codeph">fontSize</samp> attribute.
Legal values for percentages are -100% to 1000%. </p>
<p>Negative
values bring characters closer together. </p>
<p>The default value
is 0.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">typographicCase</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Controls the case in which the text appears.</p>
<p>Valid
values are <samp class="codeph">default</samp>, <samp class="codeph">capsToSmallCaps</samp>, <samp class="codeph">uppercase</samp>, <samp class="codeph">lowercase</samp>,
and <samp class="codeph">lowercaseToSmallCaps</samp>. </p>
<p>A value of <samp class="codeph">default</samp> does
not apply any case changes.A value of <samp class="codeph">smallCaps</samp> converts
all characters to uppercase and applies c2sc.</p>
<p>A value of <samp class="codeph">uppercase</samp> and <samp class="codeph">lowercase</samp> are
case conversions.A value of <samp class="codeph">caps</samp> turns on case.A
value of <samp class="codeph">lowercaseToSmallCaps</samp> converts all characters
to uppercase, and for those characters which have been converted,
applies c2sc.</p>
<p>The default value is <samp class="codeph">default</samp>.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;</samp>,
or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">verticalAlign</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Sets the vertical alignment of the lines
within the container. </p>
<p>Valid values are <samp class="codeph">top</samp>, <samp class="codeph">middle</samp>, <samp class="codeph">bottom</samp>, <samp class="codeph">justify</samp>,
and <samp class="codeph">inherit</samp>.</p>
<p>The lines might appear at the
top of the container, centered within the container, at the bottom,
or evenly spread out across the depth of the container. </p>
<p>The
default value is <samp class="codeph">top</samp>. </p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>
</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4036 ">
<p>
<samp class="codeph">whiteSpaceCollapse</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4042 ">
<p>Determines how whitespace such as line feeds,
newlines, and tabs are treated.</p>
<p>Valid values are <samp class="codeph">collapse</samp> and <samp class="codeph">preserve</samp>.</p>
<p>Set
to <samp class="codeph">collapse</samp> to convert line feeds, newlines, and
tabs to spaces, collapse adjacent spaces to one, and trim leading
and trailing whitespace.</p>
<p>Set to <samp class="codeph">preserve</samp> to
maintain whitespace without changes.</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e4048 ">
<p>
<samp class="codeph">&lt;RichText&gt;</samp>, <samp class="codeph">&lt;p&gt;,</samp> or <samp class="codeph">&lt;span&gt;</samp>
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Not all of the properties in MXML text-based controls are supported
by the <samp class="codeph">&lt;RichText&gt;</samp> tag in FXG, and not all
properties of FXG are supported by the MXML text-based controls.
For example, the RichText class in MXML does not have the margin-related
properties that the <samp class="codeph">&lt;RichText&gt;</samp> tag in FXG
has.</p>
<p>The <samp class="codeph">&lt;RichText&gt;</samp> tag is not optimized when
an FXG document is compiled. It is the only FXG element that is
not optimized because there are no low-level Flash Player instructions
for RichText.</p>
<div class="p">If you do not specify a the <samp class="codeph">width</samp> or <samp class="codeph">height</samp> properties
of the <samp class="codeph">&lt;RichText&gt;</samp> tag, or if the specified
width or height is 0, the width and height are calculated based
on the text content. This is done using the following logic for
horizontal text:<ul>
<li>
<p>If the width is specified, but the height
is not, the container height is set to the height required to fit
the text. Text wraps to the width of the container, and the total
height of the text becomes the container height.</p>
</li>
<li>
<p>If the width is not specified, then the text breaks only
at line breaks and at the paragraph end. The width of the container
is then set to the width of the longest line.</p>
</li>
<li>
<p>If neither width nor height are specified, the width is set
as described above, and then the height is set based on the width.</p>
</li>
<li>
<p>If the height is specified, and the text exceeds what will
fit, then the remaining text is preserved but does not appear in
the container; it is clipped. You can choose to add scroll bars
to view the additional text, but scroll bars are not part of FXG.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="nested1" id="WS044C4E8A-14F5-44d0-AD7F-01D3578B463F_verapache"><a name="WS044C4E8A-14F5-44d0-AD7F-01D3578B463F_verapache"><!-- --></a>
<h2 class="topictitle2">Fills in FXG and MXML graphics</h2>
<div>
<p>Fills and strokes generally define a default bounding area
that they fill, clipped by the path they are filling. Fills and
strokes can define their own user coordinate space, which defaults
to the coordinate space of the object they are filling. A fill or
stroke can modify its coordinate space with transform attributes
and child elements, similar to a Group, that is concatenated with
its parent's transforms to define a fill region in document coordinates.</p>
<p>To define a fill in FXG, you use the <samp class="codeph">&lt;fill&gt;</samp> tag
as the child of a graphic element, such as a Rect. In MXML graphics,
you use the <samp class="codeph">&lt;s:fill&gt;</samp> tag, or a class that implements
the <a href="https://flex.apache.org/asdoc/mx/graphics/IFill.html" target="_blank">mx.graphics.IFill</a> interface.
Fill elements and tags can contain a single tag that defines the
type of fill.</p>
<div class="p">The following types of fills are supported by FXG and MXML graphics:<ul>
<li>
<p>SolidColor</p>
</li>
<li>
<p>RadialGradient</p>
</li>
<li>
<p>LinearGradient</p>
</li>
<li>
<p>BitmapFill</p>
</li>
</ul>
</div>
</div>
<div class="nested2" id="WS1C293E13-929A-4f0a-B769-BCC4CBA3D9AF_verapache"><a name="WS1C293E13-929A-4f0a-B769-BCC4CBA3D9AF_verapache"><!-- --></a>
<h3 class="topictitle3">SolidColor fills</h3>
<div>
<p>A solid color fill fills a path or shape with a single
solid color or solid color with opacity. The value of the <samp class="codeph">color</samp> property
is a hexadecimal number, such as #FF00FF. In FXG, you cannot use
the 0x notation that is supported in MXML graphics.</p>
<p>In FXG, you use the <samp class="codeph">&lt;SolidColor&gt;</samp> tag to
create a solid color fill. In MXML graphics, you use the <samp class="codeph">&lt;s:SolidColor&gt;</samp> tag.</p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f3d779e1e1252d18046b-7fff_verapache"><a name="WSda78ed3a750d6b8f3d779e1e1252d18046b-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">FXG example</h4>
<div>
<p>The following FXG-based example creates a rectangle with
a SolidColor fill at 50% opacity:</p>
<div class="p">
<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SolidColorExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Solid Color Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:SolidColorComp/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following FXG file defines the SolidColorComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/SolidColorComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Draw rectangle that is filled with a SolidColor. --&gt;
&lt;Rect height="100" width="200"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="2"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;SolidColor color="#00FF00" alpha=".5"/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f3d779e1e1252d18046b-8000_verapache"><a name="WSda78ed3a750d6b8f3d779e1e1252d18046b-8000_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics example</h4>
<div>
<div class="p">The following example draws a rectangle and fills it with
a SolidColor fill at 50% opacity:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SolidColorExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;mx:Panel title="Solid Color MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;!-- Draw rectangle that is filled with a SolidColor. --&gt;
&lt;s:Rect height="100" width="200"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="0x00FF00" alpha=".5"/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<p>For more information, see the SolidColor class in the <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>.</p>
</div>
</div>
</div>
<div class="nested2" id="WS0AF4D48D-C131-47fc-8B5B-889148390956_verapache"><a name="WS0AF4D48D-C131-47fc-8B5B-889148390956_verapache"><!-- --></a>
<h3 class="topictitle3">LinearGradient fills</h3>
<div>
<p>A linear gradient fills a path or shape with a continuously
smooth color transition between a list of colors along a vector.
With gradient fills, you can use the <samp class="codeph">spreadMethod</samp> property
to define a repetition of the patterns.</p>
<p>In FXG, you use the <samp class="codeph">&lt;LinearGradient&gt;</samp> tag
to define a linear gradient. In MXML graphics, you use the <samp class="codeph">&lt;s:LinearGradient&gt;</samp> tag,
or the <a href="https://flex.apache.org/asdoc/mx/graphics/LinearGradient.html" target="_blank">mx.graphics.LinearGradient</a> class.</p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f14f5bd1d1252d1ecc9c-7fff_verapache"><a name="WSda78ed3a750d6b8f14f5bd1d1252d1ecc9c-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">FXG example</h4>
<div>
<div class="p">The following FXG-based example uses a LinearGradient fill:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/LinearGradientExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Linear Gradient Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:LinearGradientComp/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following FXG file defines the LinearGradientComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/LinearGradientComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Draw rectangle that is filled with a LinearGradient. --&gt;
&lt;Rect height="100" width="200"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="2"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;LinearGradient&gt;
&lt;GradientEntry color="#0056FF" ratio="0" alpha=".5"/&gt;
&lt;GradientEntry color="#00CC99" ratio=".33" alpha=".5"/&gt;
&lt;GradientEntry color="#ECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/LinearGradient&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f14f5bd1d1252d1ecc9c-8000_verapache"><a name="WSda78ed3a750d6b8f14f5bd1d1252d1ecc9c-8000_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics example</h4>
<div>
<div class="p">The following MXML graphics example draws a rectangle and
fills it with a LinearGradient fill:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/LinearGradientExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Linear Gradient MXML Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;!-- Draw rectangle that is filled with a LinearGradient. --&gt;
&lt;s:Rect height="100" width="200"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:LinearGradient&gt;
&lt;s:GradientEntry color="0x0056FF" ratio="0" alpha=".5"/&gt;
&lt;s:GradientEntry color="0x00CC99" ratio=".33" alpha=".5"/&gt;
&lt;s:GradientEntry color="0xECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/s:LinearGradient&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
</div>
</div>
</div>
<div class="nested2" id="WS0DDFA75B-0131-4cf2-8A4F-FA9ACFD97CD5_verapache"><a name="WS0DDFA75B-0131-4cf2-8A4F-FA9ACFD97CD5_verapache"><!-- --></a>
<h3 class="topictitle3">RadialGradient fills</h3>
<div>
<p>A radial gradient specifies a gradual color transition
in the fill color. A radial gradient defines a fill pattern that
radiates out from the center of a graphical element. </p>
<p>In FXG, you use the <samp class="codeph">&lt;RadialGradient&gt;</samp> tag
to define a radial gradient. you add a series of GradientEntry objects
to the <samp class="codeph">&lt;RadialGradient&gt;</samp> tag's <samp class="codeph">entries</samp> Array
to define the colors that make up the gradient fill.</p>
<p>In MXML graphics, you use the <samp class="codeph">&lt;s:RadialGradient&gt;</samp> tag,
or the <a href="https://flex.apache.org/asdoc/mx/graphics/RadialGradient.html" target="_blank">mx.graphics.RadialGradient</a> class.
You then define an array of entries, and add to it <a href="https://flex.apache.org/asdoc/mx/graphics/GradientEntry.html" target="_blank">GradientEntry</a> objects.</p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f-cf1a1961252d1f9894-7fff_verapache"><a name="WSda78ed3a750d6b8f-cf1a1961252d1f9894-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">FXG example</h4>
<div>
<div class="p">The following FXG-based example uses a radial gradient
in an FXG component:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/RadialGradientExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Radial Gradient Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:RadialGradientComp/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following FXG file defines the RadialGradientComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/RadialGradientComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Draw rectangle that is filled with a RadialGradient. --&gt;
&lt;Rect height="100" width="200"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="2"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;RadialGradient&gt;
&lt;GradientEntry color="#0056FF" ratio="0" alpha=".5"/&gt;
&lt;GradientEntry color="#00CC99" ratio=".33" alpha=".5"/&gt;
&lt;GradientEntry color="#ECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/RadialGradient&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f-cf1a1961252d1f9894-8000_verapache"><a name="WSda78ed3a750d6b8f-cf1a1961252d1f9894-8000_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics example</h4>
<div>
<div class="p">The following MXML graphics example draws a rectangle and
fills it with a RadialGradient fill:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/RadialGradientExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;mx:Panel title="Radial Gradient MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;s:Rect height="100" width="200"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:RadialGradient&gt;
&lt;s:GradientEntry color="0x0056FF" ratio="0" alpha=".5"/&gt;
&lt;s:GradientEntry color="0x00CC99" ratio=".33" alpha=".5"/&gt;
&lt;s:GradientEntry color="0xECEC21" ratio=".66" alpha=".5"/&gt;
&lt;/s:RadialGradient&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
</div>
</div>
</div>
<div class="nested2" id="WS50283D1A-B346-437d-BBBB-93E7F2BEB698_verapache"><a name="WS50283D1A-B346-437d-BBBB-93E7F2BEB698_verapache"><!-- --></a>
<h3 class="topictitle3">BitmapFill fills</h3>
<div>
<p>In FXG, you use the <samp class="codeph">&lt;BitmapFill&gt;</samp> tag
to fill an area with the specified bitmap data. In MXML graphics,
you use the <samp class="codeph">&lt;s:BitmapFill&gt;</samp> tag, or the <a href="https://flex.apache.org/asdoc/mx/graphics/BitmapFill.html" target="_blank">mx.graphics.BitmapFill</a> class.</p>
<p>A bitmap fill can scale or repeat its contents to fit the area.
The default behavior is to scale the bitmap data to fill the available
area. To prevent scaling, set the fillMode property to clip. If
the fill is larger than the available area, the bitmap data is clipped.
To scale the bitmap data to the available area, set the <samp class="codeph">fillMode</samp> property
to <samp class="codeph">scale</samp>. To repeat the bitmap data in the available
area, set the <samp class="codeph">fillMode</samp> property to <samp class="codeph">repeat</samp>. </p>
<p>When you set the value of the <samp class="codeph">fillMode</samp> property
in ActionScript (for MXML graphics), use the constants defined on
the <a href="https://flex.apache.org/asdoc/mx/graphics/BitmapFillMode.html" target="_blank">BitmapFillMode</a> class.</p>
<p>You can offset the position of the bitmap data inside the specified
fill area by using the <samp class="codeph">offset</samp> and <samp class="codeph">origin</samp> position
properties. You can rotate the bitmap data with the <samp class="codeph">rotation</samp> property. </p>
<p>The properties that are supported by the FXG <samp class="codeph">&lt;BitmapFill&gt;</samp> tag
are listed in <a href="flx_fxg_fx.html#WSda78ed3a750d6b8f-237979311225c0987ce-8000_verapache">Graphics
classes and elements</a>. </p>
<p>A fill's bitmap data is affected by matrix transformations that
you can define on the fill.</p>
<p>To specify the source of a bitmap fill, use the <samp class="codeph">@Embed</samp> directive
inside the <samp class="codeph">source</samp> property. This embeds the source
of the fill into the application at compile time.</p>
<p>You cannot specify the source of a bitmap fill at runtime.</p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f6816d4591252d225b17-7fff_verapache"><a name="WSda78ed3a750d6b8f6816d4591252d225b17-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">FXG example</h4>
<div>
<div class="p">The following FXG-based example defines a BitmapFill for
a rectangle:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/FXGBitmapFillExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="BitmapFill Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:BitmapFillComp/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the BitmapFillComp FXG component used
in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/BitmapFillComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;!-- Draw rectangle that is filled with a repeating bitmap. --&gt;
&lt;Rect height="100" width="200"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="2"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;BitmapFill
source="@Embed('../../assets/AirIcon12x12.gif')"
fillMode="repeat"/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f6816d4591252d225b17-8000_verapache"><a name="WSda78ed3a750d6b8f6816d4591252d225b17-8000_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics example</h4>
<div>
<div class="p">The following MXML graphics example defines a bitmap fill:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/BitmapFillExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="BitmapFill MXML Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Graphic&gt;
&lt;!-- Draw rectangle that is filled with a repeating bitmap. --&gt;
&lt;s:Rect height="100" width="200"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="2"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:BitmapFill
source="@Embed('../assets/AirIcon12x12.gif')"
fillMode="repeat"/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Graphic&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<p>For more information, see the BitmapFill class in <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>.</p>
</div>
</div>
</div>
</div>
<div class="nested1" id="WS8114D32C-2892-42ed-B230-59A94C7690E1_verapache"><a name="WS8114D32C-2892-42ed-B230-59A94C7690E1_verapache"><!-- --></a>
<h2 class="topictitle2">Bitmap graphics in FXG and MXML graphics</h2>
<div>
<p>A bitmap graphic defines a rectangular region that is filled
with bitmap data from a source file.</p>
<p>In FXG, you use the <samp class="codeph">&lt;BitmapImage&gt;</samp> tag
to draw a bitmap graphic. In MXML graphics, you use the <samp class="codeph">&lt;s:BitmapImage&gt;</samp> tag,
or the <a href="https://flex.apache.org/asdoc/spark/primitives/BitmapImage.html" target="_blank">spark.primitives.BitmapImage</a> class. </p>
<p>A bitmap image can be optionally scaled or repeated to fit the
available area. The default behavior is to scale the image to fill
the available area. To prevent scaling, set the <samp class="codeph">fillMode</samp> property
to <samp class="codeph">clip</samp>. If the image is larger than the available area,
the fill is clipped. To scale the image to the available area, set
the <samp class="codeph">fillMode</samp> property to <samp class="codeph">scale</samp>.
To repeat the image in the available area, set the <samp class="codeph">fillMode</samp> property
to <samp class="codeph">repeat</samp>. </p>
<p>The properties that are supported by the FXG <samp class="codeph">&lt;BitmapImage&gt;</samp> tag
are listed in <a href="flx_fxg_fx.html#WSda78ed3a750d6b8f-237979311225c0987ce-8000_verapache">Graphics
classes and elements</a>. </p>
<div class="p">Bitmap graphics support the following types of images:<ul>
<li>
<p>PNG</p>
</li>
<li>
<p>GIF</p>
</li>
<li>
<p>JPG</p>
</li>
</ul>
</div>
<p>When used in a clip mask, bitmap graphics are treated as bitmap-filled rectangles.
As a result, the alpha channel of the source bitmap is not relevant when
it is part of a mask. The bitmap affects the mask in the same manner
as the solid filled rectangle.</p>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f6410a1f61252d25bdd0-7fff_verapache"><a name="WSda78ed3a750d6b8f6410a1f61252d25bdd0-7fff_verapache"><!-- --></a>
<h3 class="topictitle3">FXG examples</h3>
<div>
<div class="p">The following FXG-based example displays bitmap images
in FXG:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/BitmapGraphicExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="BitmapGraphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:HGroup&gt;
&lt;!-- Single image, not resized, not repeated. --&gt;
&lt;comps:BitmapGraphicComp/&gt;
&lt;!-- Single image, scaled to fit specified dimensions. --&gt;
&lt;comps:ScaledBitmapGraphicComp/&gt;
&lt;!-- Repeated image to fit specified dimensions. --&gt;
&lt;comps:RepeatedBitmapGraphicComp/&gt;
&lt;/s:HGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following FXG file defines the BitmapGraphicComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/BitmapGraphicComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;BitmapImage
height="120"
width="120"
fillMode="clip"
source="@Embed('../../assets/AirIcon12x12.gif')"/&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The following FXG file defines the ScaledBitmapGraphicComp FXG
component used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/ScaledBitmapGraphicComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;BitmapImage
source="@Embed('../../assets/AirIcon12x12.gif')"
height="120"
width="120"
fillMode="scale"
/&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The following FXG file defines the RepeatedBitmapGraphicComp
FXG component used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/RepeatedBitmapGraphicComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;BitmapImage
source="@Embed('../../assets/AirIcon12x12.gif')"
width="120"
height="120"
fillMode="repeat"/&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f6410a1f61252d25bdd0-8000_verapache"><a name="WSda78ed3a750d6b8f6410a1f61252d25bdd0-8000_verapache"><!-- --></a>
<h3 class="topictitle3">MXML graphics examples</h3>
<div>
<div class="p">The following MXML graphics example embeds an image and
displays it in three different ways, original size, resized, and
tiled:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/BitmapGraphicExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Bitmap MXML Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:HGroup&gt;
&lt;!-- Single image, not resized, not repeated. --&gt;
&lt;s:Graphic&gt;
&lt;s:BitmapImage
width="120"
height="120"
fillMode="clip"
source="@Embed('../assets/AirIcon12x12.gif')"/&gt;
&lt;/s:Graphic&gt;
&lt;!-- Single image, scaled to fit specified dimensions. --&gt;
&lt;s:Graphic&gt;
&lt;s:BitmapImage
source="@Embed('../assets/AirIcon12x12.gif')"
width="120"
height="120"
fillMode="scale"
/&gt;
&lt;/s:Graphic&gt;
&lt;!-- Repeated image to fit specified dimensions. --&gt;
&lt;s:Graphic&gt;
&lt;s:BitmapImage
source="@Embed('../assets/AirIcon12x12.gif')"
width="120"
height="120"
fillMode="repeat"/&gt;
&lt;/s:Graphic&gt;
&lt;/s:HGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following MXML graphics example embeds the image once, and
reuses that embedded class for each of the BitmapImage instances.
It also uses the BitmapFillMode class's constants to define the
fill mode for each image.<pre class="codeblock">Ôªø&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/BitmapGraphicExampleAS.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
creationComplete="initApp()"&gt;
&lt;fx:Script&gt;
&lt;![CDATA[
import mx.graphics.BitmapFillMode;
[Embed(source="../assets/AirIcon12x12.gif")]
[Bindable]
public var airLogo:Class;
private function initApp():void {
clippedImage.fillMode = BitmapFillMode.CLIP;
repeatedImage.fillMode = BitmapFillMode.REPEAT;
scaledImage.fillMode = BitmapFillMode.SCALE;
}
]]&gt;
&lt;/fx:Script&gt;
&lt;mx:Panel title="Bitmap MXML Graphic Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:HGroup&gt;
&lt;!-- Single image, not resized, not repeated. --&gt;
&lt;s:Graphic&gt;
&lt;s:BitmapImage id="clippedImage"
width="120" height="120"
source="{airLogo}"/&gt;
&lt;/s:Graphic&gt;
&lt;!-- Single image, scaled to fit specified dimensions. --&gt;
&lt;s:Graphic&gt;
&lt;s:BitmapImage id="scaledImage"
width="120" height="120"
source="{airLogo}"/&gt;
&lt;/s:Graphic&gt;
&lt;!-- Repeated image to fit specified dimensions. --&gt;
&lt;s:Graphic&gt;
&lt;s:BitmapImage id="repeatedImage"
width="120" height="120"
source="{airLogo}"/&gt;
&lt;/s:Graphic&gt;
&lt;/s:HGroup&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<p>For more information on embedding images in MXML, see <a href="flx_embed_em.html#WS2db454920e96a9e51e63e3d11c0bf69084-7fce_verapache">Embedding
assets</a>.</p>
<p>For more information on using the BitmapImage class, see the <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>.</p>
</div>
</div>
</div>
<div class="nested1" id="WSda78ed3a750d6b8f-73a4773012528309923-8000_verapache"><a name="WSda78ed3a750d6b8f-73a4773012528309923-8000_verapache"><!-- --></a>
<h2 class="topictitle2">Effects in FXG and MXML graphics</h2>
<div>
<p>You can add effects such as masks, alpha, and blend modes
to graphic elements and groups.</p>
<div class="p">Flash Player renders graphic elements and effects on those elements
in the following order: <ol>
<li>
<p>GraphicElement or Group</p>
</li>
<li>
<p>Alpha</p>
</li>
<li>
<p>Masks</p>
</li>
<li>
<p>Filters</p>
</li>
<li>
<p>Blend modes</p>
</li>
</ol>
</div>
</div>
<div class="nested2" id="WS43301C87-6ED5-4c2d-9650-50742FED7CCD_verapache"><a name="WS43301C87-6ED5-4c2d-9650-50742FED7CCD_verapache"><!-- --></a>
<h3 class="topictitle3">Masks in FXG and MXML graphics</h3>
<div>
<p>You can add masks to any instance group element. A mask
defines the region in which the group's content is rendered. There
are two kinds of masking: clipping and alpha. </p>
<p>In <em>clip masking</em>, only the actual path, shapes, and fills
defined by the mask are used to determine the effect on the source
content. Strokes and bitmap filters on the mask are ignored. Filled
regions in the mask are considered filled, and Flash Player renders
the source content. The type of fill is not relevant: solid color, gradient
fill, or bitmap fills in a mask all render the underlying source
content, regardless of the alpha values of the mask fill.</p>
<p>In <em>alpha masking</em>, the opacity of each pixel in the source
content is multiplied by the opacity of the corresponding region
of the mask.</p>
<p>To specify a mask, you add a mask as a child of a group or graphic
element. A mask must contain a single child tag, either a Group
instance or a locally-defined tag from the library. The mask defines
its child to be the clipping mask for its parent. </p>
<p>You set the type of masking to use with the <samp class="codeph">maskType</samp> property
on the mask's parent graphical element. You can set the value of
this property to either <samp class="codeph">alpha</samp> or <samp class="codeph">clip</samp>.</p>
<p>In FXG, if the <samp class="codeph">&lt;mask&gt;</samp> tag is a child of
the root tag, then it must be the first tag. If there is a <samp class="codeph">&lt;Library&gt;</samp> tag,
then it must be the second tag.</p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f102cbeb51252d2c3476-7fff_verapache"><a name="WSda78ed3a750d6b8f102cbeb51252d2c3476-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">FXG example</h4>
<div>
<div class="p">The following example uses FXG components to define masks:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimpleMaskExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;s:VGroup gap="10" left="10" top="10"&gt;
&lt;s:RichText text="Ellipse.maskType = 'alpha'"/&gt;
&lt;comps:AlphaMaskComp/&gt;
&lt;s:RichText text="Ellipse.maskType = 'clip'"/&gt;
&lt;comps:ClipMaskComp/&gt;
&lt;/s:VGroup&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following FXG file defines the AlphaMaskComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/AlphaMaskComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Ellipse width="400" height="200" maskType="alpha"&gt;
&lt;mask&gt;
&lt;Group&gt;
&lt;Rect width="100" height="100"&gt;
&lt;fill&gt;
&lt;SolidColor alpha="0.1"/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Group&gt;
&lt;/mask&gt;
&lt;fill&gt;
&lt;SolidColor color="#FF00FF"/&gt;
&lt;/fill&gt;
&lt;/Ellipse&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">The following FXG file defines the ClipMaskComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/ClipMaskComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Ellipse width="400" height="200" maskType="clip"&gt;
&lt;mask&gt;
&lt;Group&gt;
&lt;Rect width="100" height="100"&gt;
&lt;fill&gt;
&lt;SolidColor/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Group&gt;
&lt;/mask&gt;
&lt;fill&gt;
&lt;SolidColor color="#FF00FF"/&gt;
&lt;/fill&gt;
&lt;/Ellipse&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f102cbeb51252d2c3476-8000_verapache"><a name="WSda78ed3a750d6b8f102cbeb51252d2c3476-8000_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics example</h4>
<div>
<div class="p">The following MXML graphics example shows the two types
of masks, and their effect on the underlying graphic:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/SimpleMaskExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"&gt;
&lt;s:VGroup gap="10" left="10" top="10"&gt;
&lt;s:RichText text="Ellipse.maskType = 'alpha'"/&gt;
&lt;s:Ellipse width="400" height="200" maskType="alpha"&gt;
&lt;s:mask&gt;
&lt;s:Group&gt;
&lt;s:Rect width="100" height="100"&gt;
&lt;s:fill&gt;
&lt;s:SolidColor alpha="0.1"/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/s:mask&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="#FF00FF"/&gt;
&lt;/s:fill&gt;
&lt;/s:Ellipse&gt;
&lt;s:RichText text="Ellipse.maskType = 'clip'"/&gt;
&lt;s:Ellipse width="400" height="200" maskType="clip"&gt;
&lt;s:mask&gt;
&lt;s:Group&gt;
&lt;s:Rect width="100" height="100"&gt;
&lt;s:fill&gt;
&lt;s:SolidColor/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/s:mask&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="#FF00FF"/&gt;
&lt;/s:fill&gt;
&lt;/s:Ellipse&gt;
&lt;/s:VGroup&gt;
&lt;/s:Application&gt;</pre>
</div>
</div>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f5ef2bd7012256e4b931-8000_verapache"><a name="WSda78ed3a750d6b8f5ef2bd7012256e4b931-8000_verapache"><!-- --></a>
<h3 class="topictitle3">Filters in FXG and MXML graphics</h3>
<div>
<p>A filter effect consists of a series of graphic operations
applied to the rendered graphic of a grouping element and its children
before compositing it into the background. </p>
<p>Filters can only be defined on shapes and group instances, not
group definitions. That means they can be defined on a Group tag
placed as an immediate child of a Graphic or other Group tag, or
as a child of a library object that references a defined group.</p>
<p>To define a filter in FXG, add the <samp class="codeph">&lt;filters&gt;</samp> child
tag to the Group or shape you want to apply the filter to. To define
a filter in MXML graphics, you add a <samp class="codeph">&lt;s:filters&gt;</samp> tag
to the Group or shape you want to apply the filter to. The filters
are defined in the spark.filters package. </p>
<p>The FXG <samp class="codeph">&lt;filters&gt;</samp> child tag and the <samp class="codeph">&lt;s:filters&gt;</samp> MXML
tag must contain one or more of the bitmap filter types.</p>
<p>Flash Player applies filters to the rendered content of the tag
in the order that they appear in the document: the first filter
modifies the rendered content, the second filter modifies the output
of the first filter, and so on.</p>
<div class="p">The following table lists the filters that are supported by FXG
and MXML graphics. It also lists the FXG attributes and children.
For the supported properties of the MXML graphics equivalents, see
the <em>
<a href="https://flex.apache.org/asdoc/" target="_blank">ActionScript 3.0 Reference for Apache Flex</a></em>.
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all">
<thead align="left">
<tr>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e7559">
<p>FXG tag</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e7565">
<p>Equivalent MXML graphics tag and ActionScript
class</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e7571">
<p>FXG tag attributes</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e7577">
<p>Children</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7559 ">
<p>BevelFilter</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7565 ">
<p>&lt;s:BevelFilter&gt;</p>
<p>
<a href="https://flex.apache.org/asdoc/spark/filters/BevelFilter.html" target="_blank">spark.filters.BevelFilter</a>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7571 ">
<p>angle</p>
<p>blurX</p>
<p>blurY</p>
<p>highlightAlpha</p>
<p>highlightColor</p>
<p>distance</p>
<p>knockout</p>
<p>quality</p>
<p>shadowAlpha</p>
<p>shadowColor</p>
<p>strength</p>
<p>type</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7577 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7559 ">
<p>BlurFilter</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7565 ">
<p>&lt;s:BlurFilter&gt;</p>
<p>
<a href="https://flex.apache.org/asdoc/spark/filters/BlurFilter.html" target="_blank">spark.filters.BlurFilter</a>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7571 ">
<p>blurX</p>
<p>blurY</p>
<p>quality</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7577 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7559 ">
<p>ColorMatrixFilter</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7565 ">
<p>&lt;s:ColorMatrixFilter&gt;</p>
<p>
<a href="https://flex.apache.org/asdoc/spark/filters/ColorMatrixFilter.html" target="_blank">spark.filters.ColorMatrixFilter</a>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7571 ">
<p>matrix</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7577 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7559 ">
<p>DropShadowFilter</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7565 ">
<p>&lt;s:DropShadowFilter&gt;</p>
<p>
<a href="https://flex.apache.org/asdoc/spark/filters/DropShadowFilter.html" target="_blank">spark.filters.DropShadowFilter</a>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7571 ">
<p>alpha</p>
<p>angle</p>
<p>blurX</p>
<p>blurY</p>
<p>color</p>
<p>distance</p>
<p>inner</p>
<p>hideObject</p>
<p>knockout</p>
<p>quality</p>
<p>strength</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7577 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7559 ">
<p>GlowFilter</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7565 ">
<p>&lt;s:GlowFilter&gt;</p>
<p>
<a href="https://flex.apache.org/asdoc/spark/filters/GlowFilter.html" target="_blank">spark.filters.GlowFilter</a>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7571 ">
<p>alpha</p>
<p>blurX</p>
<p>blurY</p>
<p>color</p>
<p>inner</p>
<p>knockout</p>
<p>quality</p>
<p>strength</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7577 ">
<p>None.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7559 ">
<p>GradientGlowFilter</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7565 ">
<p>&lt;s:GradientGlowFilter&gt;</p>
<p>
<a href="https://flex.apache.org/asdoc/spark/filters/GradientGlowFilter.html" target="_blank">spark.filters.GradientGlowFilter</a>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7571 ">
<p>angle</p>
<p>blurX</p>
<p>blurY</p>
<p>distance</p>
<p>inner</p>
<p>knockout</p>
<p>quality</p>
<p>strength</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7577 ">
<p>GradientEntry</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7559 ">
<p>GradientBevelFilter</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7565 ">
<p>&lt;s:GradientBevelFilter&gt;</p>
<p>
<a href="https://flex.apache.org/asdoc/spark/filters/GradientBevelFilter.html" target="_blank">spark.filters.GradientBevelFilter</a>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7571 ">
<p>angle</p>
<p>blurX</p>
<p>blurY</p>
<p>distance</p>
<p>knockout</p>
<p>quality</p>
<p>strength</p>
<p>type</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e7577 ">
<p>GradientEntry</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>MXML graphics also support an AnimateFilter effect, that lets
you animate a filter at runtime. Unlike effects that animate properties
of the target, the AnimateFilter effect animates properties of the
filter applied to the target. For more information, see <a href="flx_spark_effects_sf.html#WSFA4F2DE3-C45C-4b72-8C80-152849A6B635_verapache">Spark
filter effects</a>.</p>
<p>In some cases, you can use the <a href="https://flex.apache.org/asdoc/spark/primitives/RectangularDropShadow.html" target="_blank">RectangularDropShadow</a> class
to apply a drop shadow to a graphic element, rather than using the
DropShadowFilter effect. It is more efficient, but limited in some
ways.</p>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f3011bca11255085112a-8000_verapache"><a name="WSda78ed3a750d6b8f3011bca11255085112a-8000_verapache"><!-- --></a>
<h4 class="topictitle4">FXG examples</h4>
<div>
<div class="p">The following FXG-based example applies a drop shadow filter
to a rectangle:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/FilteredRectExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Rectangle With DropShadowFilter Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:FilteredRectComp/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the FilteredRectComp FXG component
used in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/FilteredRectComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Group&gt;
&lt;filters&gt;
&lt;DropShadowFilter distance="12" alpha=".5" strength=".33"/&gt;
&lt;/filters&gt;
&lt;Rect height="100" width="200"&gt;
&lt;stroke&gt;
&lt;SolidColorStroke color="#000000" weight="1"/&gt;
&lt;/stroke&gt;
&lt;fill&gt;
&lt;SolidColor color="#FF0000"/&gt;
&lt;/fill&gt;
&lt;/Rect&gt;
&lt;/Group&gt;
&lt;/Graphic&gt;</pre>
</div>
<div class="p">You can also apply filters to the RichText element, as the following
example shows:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/FilteredTextExample.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="TextGraphic with BlurFilter Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;comps:TextFilterComp/&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
<div class="p">The following file defines the TextFilterComp FXG component used
in the previous example:<pre class="noswf">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/comps/TextFilterComp.fxg --&gt;
&lt;Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"&gt;
&lt;Group&gt;
&lt;filters&gt;
&lt;BlurFilter/&gt;
&lt;/filters&gt;
&lt;RichText&gt;
&lt;content&gt;Hello World!&lt;/content&gt;
&lt;/RichText&gt;
&lt;/Group&gt;
&lt;/Graphic&gt;</pre>
</div>
</div>
</div>
<div class="nested3" id="WSda78ed3a750d6b8f3011bca11255085112a-7fff_verapache"><a name="WSda78ed3a750d6b8f3011bca11255085112a-7fff_verapache"><!-- --></a>
<h4 class="topictitle4">MXML graphics examples</h4>
<div>
<div class="p">The following MXML graphics example applies a drop shadow
filter to a rectangle:<pre class="codeblock">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- fxg/FilteredRectExampleMXML.mxml --&gt;
&lt;s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comps="comps.*"&gt;
&lt;mx:Panel title="Rectangle With DropShadowFilter MXML Graphics Example"
height="75%" width="75%" layout="horizontal"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"&gt;
&lt;s:Group&gt;
&lt;s:filters&gt;
&lt;s:DropShadowFilter distance="12" alpha=".5" strength=".33"/&gt;
&lt;/s:filters&gt;
&lt;s:Rect height="100" width="200"&gt;
&lt;s:stroke&gt;
&lt;s:SolidColorStroke color="0x000000" weight="1"/&gt;
&lt;/s:stroke&gt;
&lt;s:fill&gt;
&lt;s:SolidColor color="0xFF0000"/&gt;
&lt;/s:fill&gt;
&lt;/s:Rect&gt;
&lt;/s:Group&gt;
&lt;/mx:Panel&gt;
&lt;/s:Application&gt;</pre>
</div>
</div>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f45b56ddc125283156e2-8000_verapache"><a name="WSda78ed3a750d6b8f45b56ddc125283156e2-8000_verapache"><!-- --></a>
<h3 class="topictitle3">Blend modes in FXG and MXML graphics</h3>
<div>
<p>Graphical elements can control how their content is composited
with the background by specifying a <samp class="codeph">blendMode</samp> attribute.
A grouping element with the <samp class="codeph">blendMode</samp> property
set to <samp class="codeph">normal</samp> acts only as a transformation on
the elements contained within. Its 2D transform, color transform,
and opacity are multiplied down into its child elements, where they
are combined with any local values to render the child element into
the current surface.</p>
<p>In FXG, you specify a blend mode by setting the value of the <samp class="codeph">blendMode</samp> attribute
on the <samp class="codeph">&lt;Group&gt;</samp> or graphic element (like <samp class="codeph">&lt;Rect&gt;</samp>).</p>
<p>In MXML graphics, you specify a blend mode by setting the value
of the <samp class="codeph">blendMode</samp> attribute on the <samp class="codeph">&lt;s:Group&gt;</samp> tag
or graphic tag (like <samp class="codeph">&lt;s:Rect&gt;</samp>). The possible
values are defined by the <a href="https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BlendMode.html" target="_blank">flash.display.BlendMode</a> class.</p>
<div class="p">The following table describes the available blend modes in FXG:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all">
<thead align="left">
<tr>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e8110">
<p>Blend mode</p>
</th>
<th class="cellrowborder" valign="top" width="NaN%" id="d232334e8116">
<p>Description</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">add</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Adds the values of the constituent colors
of the element to the colors of its background, applying a ceiling
of 0xFF. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">alpha</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Applies the alpha value of each pixel of
the element to the background. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">auto</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>For grouping elements, acts the same as
setting the blend mode to <samp class="codeph">normal</samp> when the alpha
of the group is 0 or 1, and the blend mode is <samp class="codeph">layer</samp> when
the alpha of the group is strictly between 0 and 1. For shape elements,
acts the same as setting the blend mode to <samp class="codeph">normal</samp>.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">color</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Creates a resulting color with the luminance
of the base color and the hue and saturation of the blend color.
This preserves the gray levels in the artwork and is useful for
coloring monochrome artwork and for tinting color artwork.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">colordodge</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Brightens the base color to reflect the
blend color. Blending with black produces no change.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">colorburn</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Darkens the base color to reflect the blend
color. Blending with white produces no change.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">darken</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Selects the darker of the constituent colors
of the element and the colors of the background (the colors with
the smaller values).</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">difference</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Compares the constituent colors of the element
with the colors of its background, and subtracts the darker of the values
of the two constituent colors from the lighter value.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">erase</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Erases the background based on the alpha
value of the element. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">exclusion</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Creates an effect similar to but lower in
contrast than the Difference mode. Blending with white inverts the
base-color components. Blending with black produces no change.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">hardlight</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Adjusts the color of each pixel based on
the darkness of the element. If the element is lighter than 50%
gray, the element and background colors are screened, which results
in a lighter color. If the element is darker than 50% gray, the colors
are multiplied, which results in a darker color. This setting is
commonly used for shading effects.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">hue</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Creates a resulting color with the luminance
and saturation of the base color and the hue of the blend color. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">invert</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Inverts the background. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">layer</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>The element content is pre-composed in a
temporary buffer before it is processed further. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">lighten</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Selects the lighter of the constituent colors
of the element and the color of the background (the colors with
the larger values). </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">luminosity</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Creates a resulting color with the hue and
saturation of the base color and the luminance of the blend color.
This mode creates an inverse effect from that of the Color mode.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">multiply</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Multiplies the values of the element's constituent
colors by the colors of the background color, and then normalizes by
dividing by 0xFF, resulting in darker colors.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">normal</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>The element content appears in front of
the background. Pixel values of the element override those of the
background. Where the element is transparent, the background is
visible.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">overlay</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Adjusts the color of each pixel based on
the darkness of the background. If the background is lighter than
50% gray, the element and background colors are screened, which
results in a lighter color. If the background is darker than 50%
gray, the colors are multiplied, which results in a darker color. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>saturation</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Creates a resulting color with the luminance
and hue of the base color and the saturation of the blend color.
Painting with this mode in an area with no saturation (gray) causes
no change. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">screen</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Multiplies the complement (inverse) of the
display object color by the complement of the background color,
resulting in a bleaching effect. This setting is commonly used for
highlights or to remove black areas of the display object.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">softlight</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Darkens or lightens the colors, depending
on the blend color. The effect is similar to shining a diffused
spotlight on the artwork.If the blend color (light source) is lighter
than 50% gray, the artwork is lightened, as if it were dodged. If the
blend color is darker than 50% gray, the artwork is darkened, as
if it were burned in. Painting with pure black or white produces
a distinctly darker or lighter area but does not result in pure
black or white. </p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8110 ">
<p>
<samp class="codeph">subtract</samp>
</p>
</td>
<td class="cellrowborder" valign="top" width="NaN%" headers="d232334e8116 ">
<p>Subtracts the values of the constituent
colors in the element from the values of the background color, applying
a floor of 0. </p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>You can also set the blend mode of a shape. </p>
<p>For more information about using blend modes in FXG, see the <a href="https://sourceforge.net/adobe/flexsdk/wiki/FXG%202.0%20Specification/" target="_blank">FXG 2.0 specification</a>.</p>
</div>
</div>
<div class="nested2" id="WSda78ed3a750d6b8f-6cd35b9c12528366210-8000_verapache"><a name="WSda78ed3a750d6b8f-6cd35b9c12528366210-8000_verapache"><!-- --></a>
<h3 class="topictitle3">Color transformations in FXG and
MXML graphics</h3>
<div>
<p>Color transformations are a high performance way to modify
the color of a group or shape element. A color transform can be
used, for example, to tint a group, adjust its brightness, or modify
its opacity.</p>
<p>Color transforms are applied to the rendering of a group or shape
element after any bitmap filters are applied; color transforms affect
the <em>output</em> of a filter (such as tinting the drop shadow).
They are applied before the group element is composited with its
background. Blend modes use the transformed color value when combining
the group with the background content.</p>
<p>In FXG, you specify a color transformation by adding a <samp class="codeph">&lt;transform&gt;</samp> tag
as a child tag of a group. The <samp class="codeph">&lt;transform&gt;</samp> tag
must have a single child tag <samp class="codeph">&lt;Transform&gt;</samp>.
The <samp class="codeph">&lt;Transform&gt;</samp> tag can have a child tag <samp class="codeph">&lt;colorTransform&gt;</samp>.
The <samp class="codeph">&lt;colorTransform&gt;</samp> tag must have a single
child tag <samp class="codeph">&lt;ColorTransform&gt;</samp>. The supported
attributes of the <samp class="codeph">&lt;ColorTransform&gt;</samp> tag are
shown in <a href="flx_fxg_fx.html#WSda78ed3a750d6b8f-237979311225c0987ce-8000_verapache">Graphics
classes and elements</a>.</p>
<p>In MXML graphics, you specify a color transformation with the <a href="https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/geom/ColorTransform.html" target="_blank">flash.geom.ColorTransform</a> class.</p>
<p>Transformations are considered instanced group properties, and
can only be defined on shape elements and Groups whose parent tag
is another grouping element, or on instances of symbols. Specifically,
transformations cannot be defined on Groups whose parent tag is
a <samp class="codeph">&lt;Definition&gt;</samp> tag, or on the topmost <samp class="codeph">&lt;Graphic&gt;</samp> tag
of an FXG document.</p>
<p>Transformations can be defined on an element in one of two ways:
through discrete transform attributes, or through a child Transformation
and Matrix element. It is illegal to specify both a child element
matrix transformation and one or more transform attributes on the
same Group instance.</p>
<div class="p">Discrete transforms can be specified with the attributes <samp class="codeph">x</samp>,<samp class="codeph">y</samp>, <samp class="codeph">scaleX</samp>, <samp class="codeph">scaleY</samp>, and <samp class="codeph">rotation</samp>.
These attributes are combined to create a 2D transform matrix to
define the Group's coordinate space as follows:<ul>
<li>
<p>Scale
by <samp class="codeph">scaleX</samp>, <samp class="codeph">scaleY</samp>
</p>
</li>
<li>
<p>Rotate by <samp class="codeph">rotation</samp>
</p>
</li>
<li>
<p>Translate by <samp class="codeph">x</samp>, <samp class="codeph">y</samp>
</p>
</li>
</ul>
</div>
<p>For more information about using color transformations in FXG,
see the <a href="https://sourceforge.net/adobe/flexsdk/wiki/FXG%202.0%20Specification/" target="_blank">FXG 2.0 specification</a>.</p>
</div>
</div>
<div>
<p><strong>Navigation</strong></p>
<p><a href="index.html">Using Flex</a> &raquo; <a href="flx_p5_enhancing_ui.html">Enhancing the user interface</a></p>
</div>
<p>Adobe, Adobe Photoshop, Adobe Illustrator, Adobe Fireworks, Adobe Flash Platform and Adobe Flash Player are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries and are used by permission from Adobe. No other license to the Adobe trademarks are granted.</p>
</div>
</body>
</html>