Accessibility
 
Home > Products > Director > Support > Vector Shapes and Bitmaps
Macromedia Director Support Center - Vector Shapes and Bitmaps
Controlling vertices

Use these Lingo terms to work with a vector shape's vertices.

To display a list that contains the location of each vertex and control handle in a vector shape, test the vertexList property.
This Lingo displays the vertexList of member 5 in the Message window:
put member(5).vertexList
-- [[#vertex: point(-30.0000, 12.0000)], [#vertex: point(8.0000, 14.0000)], [#vertex: point(22.0000, -10.0000), #handle1: point(-7.5685, -8.4094), #handle2: point(18.0000, 20.0000)], [#vertex: point(-19.0000, -12.0000)]]
Notice that the third vertex includes two handles.
To get the location of a specific vertex, use the vertex chunk expression.
This Lingo displays the location of the third vertex of cast member 1:
put member(1).vertex[3]
You can modify or animate a vector shape by moving its vertices and vertex handles with the moveVertex and moveVertexHandle commands.
The following Lingo animates the vector shape described above by moving the location of the second handle of the third vertex over time with the moveVertexHandle command. Each time the playback head loops in the frame, the horizontal value of the handle is increased by 5 pixels and the vertical value of the handle is decreased by 5 pixels.
on exitFrame
	moveVertexHandle(member 1, 3, 2, 5, -5)
	go to the frame
end
To modify a vector shape by adding or deleting a vertex, use the addVertex() or deleteVertex() commands. Adding vertices makes the shape more complex, while deleting vertices makes the shape simpler.
This Lingo adds a new vertex to the third position in the vertexList of member 1:
addVertex(member 1, 3, point(15, 10))
The point value is relative to the center of the vector shape cast member. If the originMode property is changed from its default value of #center to a value of #topLeft , then the point value will be relative to the top left corner of the vector shape.
You can also specify the locations of the control handles for the new vertex by adding their point values at the end of the addVertex command.
This statement adds a new vertex to position three of the vertexList of member 1 and specifies the locations of the handles for the new vertex:
addVertex(member 1, 3, point(15, 10), point(20, 10), point(10, 10))
This Lingo deletes the third vertex from vector shape member 1:
deleteVertex(member 1, 3)
To refer to the vertexList of only one curve in a vector shape with multiple curves, use the curve property.
This statement uses the curve property to display only the vertices of the second curve of member 8 in the Message window:
put member(8).curve[2]
-- [[#vertex: point(-41.0000, 77.0000)], [#vertex: point(36.0000, 67.0000)], [#newCurve]]
The following statement uses the vertexList to display the vertices of both curves of member 8 in the Message window. The curve described in the previous example appears at the end of the returned vertexList .
put member(8).vertexList
-- [[#vertex: point(-41.0000, -43.0000), #handle1: point(12.0000, 10.0000), #handle2: point(-12.0000, -10.0000)], [#vertex: point(41.0000, -47.0000)], [#vertex: point(7.0000, -76.0000)], [#newCurve], [#vertex: point(-41.0000, 77.0000)], [#vertex: point(36.0000, 67.0000)], [#newCurve]]
To add a new curve to the vector shape, use the newCurve() command.
The following Lingo adds a new curve to cast member 2 at the third position in the cast member's vertexList . The second line of the example replaces the contents of curve 3 with the second curve of a separate vector shape member 5.
member(2).newCurve(3)
member(2).curve[3]=member(5).curve[2]

To Table of Contents Forward to next document