Package | spark.primitives |
Class | public class Path |
Inheritance | Path ![]() ![]() ![]() ![]() ![]() |
Language Version: | ActionScript 3.0 |
Product Version: | Flex 4 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Typically, the first element of a path definition is a Move segment to specify the starting pen position of the graphic. You then use the Line, CubicBezier and QuadraticBezier segments to draw the lines of the graphic. When using these classes, you only specify the x and y coordinates of the end point of the line; the x and y coordinate of the starting point is defined by the current pen position.
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 multiple Move segments in the path definition to reposition the pen.
The syntax used by the Path class to define the shape is the same as the SVG path syntax, which makes it easy to convert SVG paths to Flex paths.
More examples
Property | Defined By | ||
---|---|---|---|
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object |
Method | Defined By | ||
---|---|---|---|
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | |
![]() |
Dispatches an event into the event flow. | EventDispatcher | |
![]() |
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | |
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Removes a listener from the EventDispatcher object. | EventDispatcher | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
![]() |
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Method | Defined By |
---|
<?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>
Wed Nov 21 2018, 06:34 AM -08:00