Vertex object

 < Day Day Up > 

Availability

Flash MX 2004.

Description

The Vertex object is the part of the shape data structure that holds the coordinate data.

Method summary for the Vertex object

You can use the following methods with the Vertex object.

Method

Description

vertex.getHalfEdge()

Gets a HalfEdge object that shares this vertex.

vertex.setLocation()

Sets the location of the vertex.


Property summary for the Vertex object

The following properties are available for the Vertex object:

Property

Description

vertex.x

Read-only; the x location of the vertex in pixels.

vertex.y

Read-only; the y location of the vertex in pixels.


vertex.getHalfEdge()

Availability

Flash MX 2004.

Usage

vertex.getHalfEdge()

Parameters

None.

Returns

A HalfEdge object.

Description

Method; gets a HalfEdge object that shares this vertex.

Example

The following example shows how to get other half edges that share the same vertex.

var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge(0); var theVertex = hEdge.getVertex(); var someHEdge = theVertex.getHalfEdge(); // Not necessarily the same half   edge var theSameVertex = someHEdge.getVertex(); fl.trace('the same vertex: ' + theSameVertex);

vertex.setLocation()

Availability

Flash MX 2004.

Usage

vertex.setLocation( x, y )

Parameters

x A floating-point value that specifies the x coordinate of where the vertex should be positioned, in pixels.

y A floating-point value that specifies the y coordinate of where the vertex should be positioned, in pixels.

Returns

Nothing.

Description

Method; sets the location of the vertex. You must call shape.beginEdit() before using this method.

Example

The following example sets the vertex to the origin point.

var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge(0); var vertex = hEdge.getVertex(); // Move the vertex to the origin. vertex.setLocation(0.0, 0.0);

vertex.x

Availability

Flash MX 2004.

Usage

vertex.x

Description

Read-only property; the x location of the vertex in pixels.

Example

The following example displays the location of the x and y values of the vertex in the Output panel.

var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge(0); var vertex = hEdge.getVertex(); fl.trace('x location of vertex is: ' + vertex.x); fl.trace('y location of vertex is: ' + vertex.y);

vertex.y

Availability

Flash MX 2004.

Usage

vertex.y

Description

Read-only property; the y location of the vertex, in pixels.

Example

See vertex.x.

     < Day Day Up > 


    Developing Extensions for Macromedia Flash 8
    Developing Extensions for Macromedia Flash 8
    ISBN: 032139416X
    EAN: 2147483647
    Year: 2005
    Pages: 81

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net