Package | spark.primitives |
Class | public class Line |
Inheritance | Line StrokedElement GraphicElement flash.events.EventDispatcher |
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
The default stroke for a line is undefined; therefore, if you do not specify the stroke, the line is invisible.
See also
Property | Defined By | ||
---|---|---|---|
alpha : Number
The level of transparency of the graphic element. | GraphicElement | ||
alwaysCreateDisplayObject : Boolean
Specifies that this GraphicElement is to be associated with and be rendered
to its own DisplayObject. | GraphicElement | ||
baseline : Object
The vertical distance in pixels from the anchor target to
the control's baseline position. | GraphicElement | ||
baselinePosition : Number [read-only]
The y-coordinate of the baseline
of the first line of text of the component. | GraphicElement | ||
blendMode : String
A value from the BlendMode class that specifies which blend mode to use. | GraphicElement | ||
bottom : Object
The vertical distance in pixels from the bottom edge of the component to the
anchor target's bottom edge. | GraphicElement | ||
depth : Number
Determines the order in which items inside of containers
are rendered. | GraphicElement | ||
designLayer : DesignLayer
Specifies the optional DesignLayer instance associated with this visual
element. | GraphicElement | ||
displayObject : DisplayObject [read-only]
The shared DisplayObject where this
IGraphicElement is drawn. | GraphicElement | ||
displayObjectSharingMode : String
Indicates the association between this IGraphicElement and its
display objects. | GraphicElement | ||
explicitHeight : Number
Number that specifies the explicit height of the component,
in pixels, in the component's coordinates. | GraphicElement | ||
explicitMaxHeight : Number
The maximum recommended height of the component to be considered
by the parent during layout. | GraphicElement | ||
explicitMaxWidth : Number
The maximum recommended width of the component to be considered
by the parent during layout. | GraphicElement | ||
explicitMinHeight : Number
The minimum recommended height of the component to be considered
by the parent during layout. | GraphicElement | ||
explicitMinWidth : Number
The minimum recommended width of the component to be considered
by the parent during layout. | GraphicElement | ||
explicitWidth : Number
Number that specifies the explicit width of the component,
in pixels, in the component's coordinates. | GraphicElement | ||
filters : Array
An indexed array that contains each filter object currently associated with the graphic element. | GraphicElement | ||
hasLayoutMatrix3D : Boolean [read-only]
Contains true if the element has 3D Matrix. | GraphicElement | ||
height : Number
The height of the graphic element. | GraphicElement | ||
horizontalCenter : Object
The horizontal distance in pixels from the center of the component to the
center of the anchor target's content area. | GraphicElement | ||
id : String
The identity of the component. | GraphicElement | ||
includeInLayout : Boolean
Specifies whether this element is included in the layout of the parent. | GraphicElement | ||
is3D : Boolean [read-only]
Contains true when the element is in 3D. | GraphicElement | ||
layoutDirection : String
Specifies the desired layout direction for an element: one of LayoutDirection.LTR
(left to right), LayoutDirection.RTL (right to left), or null (inherit). | GraphicElement | ||
left : Object
The horizontal distance in pixels from the left edge of the component to the
anchor target's left edge. | GraphicElement | ||
luminosityClip : Boolean
A property that controls whether the luminosity
mask clips the masked content. | GraphicElement | ||
luminosityInvert : Boolean
A property that controls the calculation of the RGB
color value of a graphic element being masked by
a luminosity mask. | GraphicElement | ||
mask : DisplayObject
The calling display object is masked by the specified mask object. | GraphicElement | ||
maskType : String
Defines how the mask is applied to the GraphicElement.
The possible values are MaskType.CLIP, MaskType.ALPHA, and
MaskType.LUMINOSITY.
Clip Masking
When masking in clip mode, a clipping masks is reduced to 1-bit. | GraphicElement | ||
maxHeight : Number
The maximum recommended height of the component to be considered
by the parent during layout. | GraphicElement | ||
maxWidth : Number
The maximum recommended width of the component to be considered
by the parent during layout. | GraphicElement | ||
measuredHeight : Number
The default height of the component, in pixels. | GraphicElement | ||
measuredWidth : Number
The default width of the component, in pixels. | GraphicElement | ||
measuredX : Number
The default measured bounds top-left corner relative to the origin of the element. | GraphicElement | ||
measuredY : Number
The default measured bounds top-left corner relative to the origin of the element. | GraphicElement | ||
minHeight : Number
The minimum recommended height of the component to be considered
by the parent during layout. | GraphicElement | ||
minWidth : Number
The minimum recommended width of the component to be considered
by the parent during layout. | GraphicElement | ||
MXMLDescriptor : Array [read-only] | GraphicElement | ||
MXMLProperties : Array [read-only] | GraphicElement | ||
owner : DisplayObjectContainer
The owner of this IVisualElement object. | GraphicElement | ||
parent : DisplayObjectContainer [read-only]
The parent container or component for this component. | GraphicElement | ||
percentHeight : Number
Specifies the height of a component as a percentage
of its parent's size. | GraphicElement | ||
percentWidth : Number
Specifies the width of a component as a percentage
of its parent's size. | GraphicElement | ||
postLayoutTransformOffsets : TransformOffsets
Defines a set of adjustments that can be applied to the object's
transform in a way that is invisible to its parent's layout. | GraphicElement | ||
right : Object
The horizontal distance in pixels from the right edge of the component to the
anchor target's right edge. | GraphicElement | ||
rotation : Number
Indicates the rotation of the element, in degrees,
from the transform point. | GraphicElement | ||
rotationX : Number
Indicates the x-axis rotation of the element instance, in degrees, from its original orientation
relative to the 3D parent container. | GraphicElement | ||
rotationY : Number
Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation
relative to the 3D parent container. | GraphicElement | ||
rotationZ : Number
Indicates the rotation of the element, in degrees,
from the transform point. | GraphicElement | ||
scaleX : Number
The horizontal scale (percentage) of the element
as applied from the transform point. | GraphicElement | ||
scaleY : Number
The vertical scale (percentage) of the element
as applied from the transform point. | GraphicElement | ||
scaleZ : Number
The z scale (percentage) of the element
as applied from the transform point. | GraphicElement | ||
stroke : IStroke
The stroke used by this element. | StrokedElement | ||
top : Object
The vertical distance in pixels from the top edge of the component to the
anchor target's top edge. | GraphicElement | ||
transform : Transform | GraphicElement | ||
transformX : Number
The x position transform point of the element. | GraphicElement | ||
transformY : Number
The y position transform point of the element. | GraphicElement | ||
transformZ : Number
The z position transform point of the element. | GraphicElement | ||
verticalCenter : Object
The vertical distance in pixels from the center of the component to the
center of the anchor target's content area. | GraphicElement | ||
visible : Boolean
Controls the visibility of this visual element. | GraphicElement | ||
width : Number
The width of the graphic element. | GraphicElement | ||
x : Number
The x position of the graphic element. | GraphicElement | ||
xFrom : Number
The starting x position for the line. | Line | ||
xTo : Number
The ending x position for the line. | Line | ||
y : Number
The y position of the graphic element. | GraphicElement | ||
yFrom : Number
The starting y position for the line. | Line | ||
yTo : Number
The ending y position for the line. | Line | ||
z : Number
The z position of the graphic element. | GraphicElement |
Method | Defined By | ||
---|---|---|---|
Line()
Constructor. | Line | ||
canShareWithNext(element:IGraphicElement):Boolean
Returns true if this IGraphicElement is compatible and can
share display objects with the next IGraphicElement
in the sequence. | GraphicElement | ||
canShareWithPrevious(element:IGraphicElement):Boolean
Returns true if this IGraphicElement is compatible and can
share display objects with the previous IGraphicElement
in the sequence. | GraphicElement | ||
createDisplayObject():DisplayObject
Creates a new DisplayObject where this IGraphicElement
is drawn. | GraphicElement | ||
generateMXMLArray(document:Object, data:Array, recursive:Boolean = true):Array | GraphicElement | ||
generateMXMLVector(document:Object, data:Array, recursive:Boolean = true):* | GraphicElement | ||
getBoundsXAtSize(width:Number, height:Number, postLayoutTransform:Boolean = true):Number
Returns the x coordinate of the element's bounds at the specified element size. | GraphicElement | ||
getBoundsYAtSize(width:Number, height:Number, postLayoutTransform:Boolean = true):Number
Returns the y coordinate of the element's bounds at the specified element size. | GraphicElement | ||
getLayoutBoundsHeight(postLayoutTransform:Boolean = true):Number
Returns the element's layout height. | GraphicElement | ||
getLayoutBoundsWidth(postLayoutTransform:Boolean = true):Number
Returns the element's layout width. | GraphicElement | ||
getLayoutBoundsX(postLayoutTransform:Boolean = true):Number
Returns the x coordinate that the element uses to draw on screen. | GraphicElement | ||
getLayoutBoundsY(postLayoutTransform:Boolean = true):Number
Returns the y coordinate that the element uses to draw on screen. | GraphicElement | ||
getLayoutMatrix():Matrix
Returns the transform matrix that is used to calculate the component's
layout relative to its siblings. | GraphicElement | ||
getLayoutMatrix3D():Matrix3D
Returns the layout transform Matrix3D for this element. | GraphicElement | ||
getMaxBoundsHeight(postLayoutTransform:Boolean = true):Number
Returns the element's maximum height. | GraphicElement | ||
getMaxBoundsWidth(postLayoutTransform:Boolean = true):Number
Returns the element's maximum width. | GraphicElement | ||
getMinBoundsHeight(postLayoutTransform:Boolean = true):Number
Returns the element's minimum height. | GraphicElement | ||
getMinBoundsWidth(postLayoutTransform:Boolean = true):Number
Returns the element's minimum width. | GraphicElement | ||
getPreferredBoundsHeight(postLayoutTransform:Boolean = true):Number
Returns the element's preferred height. | GraphicElement | ||
getPreferredBoundsWidth(postLayoutTransform:Boolean = true):Number
Returns the element's preferred width. | GraphicElement | ||
initialized(document:Object, id:String):void
Called automatically by the MXML compiler when the GraphicElement
is created using an MXML tag. | GraphicElement | ||
invalidateDisplayList():void
Calling this method results in a call to the elements's
validateDisplayList() method
before the display list is rendered. | GraphicElement | ||
invalidateLayoutDirection():void
An element must call this method when its layoutDirection changes or
when its parent's layoutDirection changes. | GraphicElement | ||
invalidateProperties():void
Calling this method results in a call to the elements's
validateProperties() method
before the display list is rendered. | GraphicElement | ||
invalidateSize():void
Calling this method results in a call to the elements's
validateSize() method
before the display list is rendered. | GraphicElement | ||
localToGlobal(point:Point):Point
Converts the point object from the object's (local) coordinates
to the Stage (global) coordinates. | GraphicElement | ||
parentChanged(value:IGraphicElementContainer):void
Called by IGraphicElementContainer when an IGraphicElement
is added to or removed from the host component. | GraphicElement | ||
setLayoutBoundsPosition(newBoundsX:Number, newBoundsY:Number, postLayoutTransform:Boolean = true):void
Sets the coordinates that the element uses to draw on screen. | GraphicElement | ||
setLayoutBoundsSize(width:Number, height:Number, postLayoutTransform:Boolean = true):void
Sets the layout size of the element. | GraphicElement | ||
setLayoutMatrix(value:Matrix, invalidateLayout:Boolean):void
Sets the transform Matrix that is used to calculate the component's layout
size and position relative to its siblings. | GraphicElement | ||
setLayoutMatrix3D(value:Matrix3D, invalidateLayout:Boolean):void
Sets the transform Matrix3D that is used to calculate the component's layout
size and position relative to its siblings. | GraphicElement | ||
setMXMLDescriptor(value:Array):void | GraphicElement | ||
setMXMLProperties(value:Array):void | GraphicElement | ||
setSharedDisplayObject(sharedDisplayObject:DisplayObject):Boolean
Determines whether this element can draw itself to the
sharedDisplayObject of the sequence. | GraphicElement | ||
transformAround(transformCenter:Vector3D, scale:Vector3D = null, rotation:Vector3D = null, translation:Vector3D = null, postLayoutScale:Vector3D = null, postLayoutRotation:Vector3D = null, postLayoutTranslation:Vector3D = null, invalidateLayout:Boolean = true):void
A utility method to update the rotation, scale, and translation of the
transform while keeping a particular point, specified in the component's
own coordinate space, fixed in the parent's coordinate space. | GraphicElement | ||
transformPointToParent(localPosition:Vector3D, position:Vector3D, postLayoutPosition:Vector3D):void
A utility method to transform a point specified in the local
coordinates of this object to its location in the object's parent's
coordinates. | GraphicElement | ||
validateDisplayList():void
Called by the IGraphicElementContainer to redraw this element
in its displayObject property. | GraphicElement | ||
validateNow():void
Validates and updates the properties and layout of this object
by immediately calling validateProperties(),
validateSize(), and validateDisplayList(),
if necessary. | GraphicElement | ||
validateProperties():void
Used by layout logic to validate the properties of a component
by calling the commitProperties() method. | GraphicElement | ||
validateSize():void
Called by the IGraphicElementContainer to validate the size of
this element. | GraphicElement |
Method | Defined By | ||
---|---|---|---|
beginDraw(g:Graphics):void
Set up the drawing for this element. | StrokedElement | ||
canSkipMeasurement():Boolean [override]
Determines if the call to the measure() method can be skipped. | Line | ||
commitProperties():void
Processes the properties set on the element. | GraphicElement | ||
draw(g:Graphics):void [override]
Draw the element. | Line | ||
endDraw(g:Graphics):void
Finalize drawing for this element. | StrokedElement | ||
generateMXMLAttributes(data:Array):void | GraphicElement | ||
generateMXMLInstances(document:Object, data:Array, recursive:Boolean = true):void | GraphicElement | ||
generateMXMLObject(document:Object, data:Array):Object | GraphicElement | ||
getStrokeExtents(postLayoutTransform:Boolean = true):Rectangle
Returns the amount of pixels occupied by the stroke on each side
of the element's bounds. | GraphicElement | ||
Utility method that notifies the host that this element has changed and needs
its layer to be updated. | GraphicElement | ||
Helper method to invalidate parent size and display list if
this object affects its layout (includeInLayout is true). | GraphicElement | ||
measure():void [override]
Calculates the default size of the element. | Line | ||
preferredHeightPreTransform():Number
Used for the implementation of the ILayoutElement interface,
returns the explicit measured height pre-transform. | GraphicElement | ||
preferredWidthPreTransform():Number
Used for the implementation of the ILayoutElement interface,
returns the explicit of measured width pre-transform. | GraphicElement | ||
transformHeightForLayout(width:Number, height:Number, postLayoutTransform:Boolean = true):Number
Transform the element's size. | GraphicElement | ||
transformWidthForLayout(width:Number, height:Number, postLayoutTransform:Boolean = true):Number
Transform the element's size. | GraphicElement | ||
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void [override]
Draws the element and/or sizes and positions its content. | StrokedElement |
xFrom | property |
xFrom:Number
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
The starting x position for the line.
The default value is 0
.
public function get xFrom():Number
public function set xFrom(value:Number):void
xTo | property |
xTo:Number
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
The ending x position for the line.
The default value is 0
.
public function get xTo():Number
public function set xTo(value:Number):void
yFrom | property |
yFrom:Number
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
The starting y position for the line.
The default value is 0
.
public function get yFrom():Number
public function set yFrom(value:Number):void
yTo | property |
yTo:Number
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
The ending y position for the line.
The default value is 0
.
public function get yTo():Number
public function set yTo(value:Number):void
Line | () | Constructor |
public function Line()
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
Constructor.
canSkipMeasurement | () | method |
override protected function canSkipMeasurement():Boolean
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
Determines if the call to the measure()
method can be skipped.
Boolean — Returns true when the measureSizes() method can skip the call to
the measure() method. For example this is usually true when both the explicitWidth and
explicitHeight properties are set. For paths, this is true when the bounds of the path
have not changed.
|
draw | () | method |
override protected function draw(g:Graphics):void
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
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()
.
Parameters
g:Graphics — The graphic element to draw.
|
measure | () | method |
override protected function measure():void
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 10, AIR 1.5 |
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:
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"?> <!-- 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. --> <!-- examples/LineExample.mxml --> <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"> <mx:Panel title="Line MXML Graphic Example" height="75%" width="75%" layout="horizontal" paddingTop="30" paddingBottom="10" paddingLeft="10" paddingRight="10"> <s:Group x="20" y="20"> <s:Line xFrom="0" xTo="0" yFrom="0" yTo="100"> <!-- Define the border color of the line. --> <s:stroke> <s:SolidColorStroke color="0x000000" weight="1" caps="square"/> </s:stroke> </s:Line> <s:Line xFrom="6" xTo="6" yFrom="0" yTo="100"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="1" caps="square"/> </s:stroke> </s:Line> <s:Line xFrom="12" xTo="12" yFrom="0" yTo="100"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="2" caps="square"/> </s:stroke> </s:Line> <s:Line xFrom="20" xTo="20" yFrom="0" yTo="100"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="3" caps="square"/> </s:stroke> </s:Line> <s:Line xFrom="30" xTo="30" yFrom="0" yTo="100"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="5" caps="square"/> </s:stroke> </s:Line> <s:Line xFrom="43" xTo="43" yFrom="0" yTo="100"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="8" caps="square"/> </s:stroke> </s:Line> <s:Line xFrom="58" xTo="58" yFrom="0" yTo="100"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="13" caps="square"/> </s:stroke> </s:Line> <s:Line xFrom="84" xTo="84" yFrom="0" yTo="100"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="21" caps="square"/> </s:stroke> </s:Line> <s:Line xFrom="123" xTo="123" yFrom="0" yTo="100"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="34" caps="square"/> </s:stroke> </s:Line> </s:Group> </mx:Panel> </s:Application>