data:String
A string containing a compact represention of the path segments. This is an alternate
way of setting the segments property. Setting this property overrides any values
stored in the segments array property.
The value is a space-delimited string describing each path segment. Each
segment entry has a single character which denotes the segment type and
two or more segment parameters.
If the segment command is upper-case, the parameters are absolute values.
If the segment command is lower-case, the parameters are relative values.
The following table shows the syntax for the segments:
M 10 20 – Move line to 10, 20.L 50 30 – Line to 50, 30.H 40 = Horizontal line to 40.V 100 – Vertical line to 100.Q 110 45 90 30 – Curve to 90, 30 with the control point at 110, 45.C 45 50 20 30 10 20 – Curve to 10, 20 with the first control point at 45, 50 and the second control point at 20, 30. 기본값: null.
public function get data():String public function set data(value:String):void
winding:String
Fill rule for intersecting or overlapping path segments.
Possible values are GraphicsPathWinding.EVEN_ODD or GraphicsPathWinding.NON_ZERO.
기본값: evenOdd.
public function get winding():String public function set winding(value:String):void
public function Path()
Constructor.
override protected function draw(g:Graphics):void
Draw the element. This is the second of three steps taken during the drawing
process. Override this method to implement your drawing. The stroke
(and fill, if applicable) have been set in the beginDraw() method.
Your override should only contain calls to drawing methods such as
moveTo(), curveTo(), and drawRect().
:Graphics — The graphic element to draw.
override protected function endDraw(g:Graphics):void
Finalize drawing for this element. This is the final of the three steps taken
during the drawing process. In this step, fills are closed.
:Graphics — The graphics element to finish drawing.
override public function getBoundsXAtSize(width:Number, height:Number, postLayoutTransform:Boolean = true):Number
Returns the x coordinate of the element’s bounds at the specified element size.
This method is typically used by layouts during a call to the
measure() method to predict what
the element position will be, if the element is resized to particular dimensions.
:Number — The element’s bounds width, or NaN to use the preferred width.
:Number — The element’s bounds height, or NaN to use the preferred height.
:Boolean (default = true) — When postLayoutTransform is true, the method returnsx coordinate of the element’s bounding box top-left corner.
The bounding box is in element’s parent coordinate space and is calculated
from the specified bounds size, layout position and layout transform matrix.
Number — The x coordinate of the element’s bounds at the specified element size.
override public function getBoundsYAtSize(width:Number, height:Number, postLayoutTransform:Boolean = true):Number
Returns the y coordinate of the element’s bounds at the specified element size.
This method is typically used by layouts during a call to
the measure() to predict what
the element position will be, if the element is resized to particular dimensions.
:Number — The element’s bounds width, or NaN to use the preferred width.
:Number — The element’s bounds height, or NaN to use the preferred height.
:Boolean (default = true) — When postLayoutTransform is true, the method returnsthe y coordinate of the element’s bounding box top-left corner.
The bounding box is in element’s parent coordinate space and is calculated
from the specified bounds size, layout position and layout transform matrix.
Number — The y coordinate of the element’s bounds at the specified element size.
override protected function invalidateDisplayObjectSharing():void
Utility method that notifies the host that this element has changed and needs
its layer to be updated.
override protected function measure():void
Calculates the default size of the element. This is an advanced
method that you might override when creating a subclass of GraphicElement.
You do not call this method directly. Flex calls the
measure() method when the element is added to an
IGraphicElementContainer container such as Group
using the addElement() method, and when the element’s
invalidateSize() method is called.
By default you set both explicit height and explicit width of an element,
Flex does not call the measure() method,
even if you explicitly call the invalidateSize() method.
To override this behavior, override skipMeasure() method.
In your override of this method, you must set the
measuredWidth and measuredHeight properties
to define the default size.
You can optionally set the measuredX and
measuredY properties to define the default measured bounds
top-left corner relative to the origin of the element.
The conceptual point of measure() is for the element to
provide its own natural or intrinsic bounds as a default. Therefore, the
measuredWidth and measuredHeight properties
should be determined by factors such as:
- The amount of text the component needs to display.
- The size of a JPEG image that the component displays.
In some cases, there is no intrinsic way to determine default values.
For example, a simple GreenCircle element might simply set
measuredWidth = 100 and measuredHeight = 100 in its measure() method to
provide a reasonable default size. In other cases, such as a TextArea,
an appropriate computation (such as finding the right width and height
that would just display all the text and have the aspect ratio of a Golden Rectangle)
might be too time-consuming to be worthwhile.
The default implementation of measure()
sets the values of the measuredWidth, measuredHeight,
measuredX, and measuredY properties
to 0.
<?xml version="1.0" encoding="utf-8"?>
<!-- ArrowExample.mxml -->
<s:Application name="ArrowExample"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:Panel title="Arrow Graphic Example"
width="75%" height="75%"
horizontalCenter="0" verticalCenter="0">
<s:Group left="10" right="10" top="10" bottom="10">
<s:Graphic x="100" y="0">
<!-- Use Use compact syntax with absolute coordinates. -->
<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">
<!-- Define the border color of the arrow. -->
<s:stroke>
<s:SolidColorStroke color="0x888888"/>
</s:stroke>
<!-- Define the fill for the arrow. -->
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0x000000" alpha="0.8"/>
<s:GradientEntry color="0xFFFFFF" alpha="0.8"/>
</s:LinearGradient>
</s:fill>
</s:Path>
</s:Graphic>
<s:Graphic x="200" y="0">
<!-- Use compact syntax with relative coordinates. -->
<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">
<!-- Define the border color of the arrow. -->
<s:stroke>
<s:SolidColorStroke color="0x888888"/>
</s:stroke>
<!-- Define the fill for the arrow. -->
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0x000000" alpha="0.8"/>
<s:GradientEntry color="0xFFFFFF" alpha="0.8"/>
</s:LinearGradient>
</s:fill>
</s:Path>
</s:Graphic>
</s:Group>
</s:Panel>
</s:Application>










