< Day Day Up > |
Inheritance Element object > Shape object Availability Flash MX 2004. Description The Shape object is a subclass of the Element object. The Shape object provides more precise control than the Drawing APIs when manipulating or creating geometry on the Stage. This control is necessary so that scripts can create useful effects and other drawing commands. (See Element object.) All Shape methods and properties that change a shape or any of its subordinate parts must be placed between shape.beginEdit() and shape.endEdit() calls to function correctly. Method summary for the Shape objectIn addition to the Element object methods, you can use the following methods with the Shape object:
Property summary for the Shape objectIn addition to the Element object properties, the following properties are available for the Shape object:
shape.beginEdit()Availability Flash MX 2004. Usage shape.beginEdit() Parameters None. Returns Nothing. Description Method; defines the start of an edit session. You must use this method before issuing any commands that change the Shape object or any of its subordinate parts. Example The following example takes the currently selected shape and removes the first edge in the edge array from it: var shape = fl.getDocumentDOM().selection[0]; shape.beginEdit(); shape.deleteEdge(0); shape.endEdit(); shape.contoursAvailability Flash MX 2004. Usage shape.contours Description Read-only property; an array of Contour objects for the shape (see Contour object). Example The following example stores the first contour in the contours array in the c variable and then stores the HalfEdge object of that contour in the he variable: var c = fl.getDocumentDOM().selection[0].contours[0]; var he = c.getHalfEdge(); shape.deleteEdge()Availability Flash MX 2004. Usage shape.deleteEdge( index ) Parameters index A zero-based index that specifies the edge to delete from the shape.edges array. This method changes the length of the shape.edges array. Returns Nothing. Description Method; deletes the specified edge. You must call shape.beginEdit() before using this method. Example The following example takes the currently selected shape and removes the first edge in the edge array: var shape = fl.getDocumentDOM().selection[0]; shape.beginEdit(); shape.deleteEdge(0); shape.endEdit(); shape.edgesAvailability Flash MX 2004. Usage shape.edges Description Read-only property; an array of Edge objects (see Edge object). shape.endEdit()Availability Flash MX 2004. Usage shape.endEdit() Parameters None. Returns Nothing. Description Method; defines the end of an edit session for the shape. All changes made to the Shape object or any of its subordinate parts will be applied to the shape. You must use this method after issuing any commands that change the Shape object or any of its subordinate parts. Example The following example takes the currently selected shape and removes the first edge in the edge array from it: var shape = fl.getDocumentDOM().selection[0]; shape.beginEdit(); shape.deleteEdge(0); shape.endEdit(); shape.isDrawingObjectAvailability Flash 8. Usage shape.isDrawingObject Description Read-only property; if true, the shape is a drawing object. Example The following example stores the first selected item object in the sel variable and then uses the element.elementType and shape.isDrawingObject properties to determine if the selected item is a drawing object. var sel = fl.getDocumentDOM().selection[0]; var shapeDrawingObject = (sel.elementType == "shape") && sel.isDrawingObject; fl.trace(shapeDrawingObject); See also document.crop(), document.deleteEnvelope(), document.intersect(), document.punch(), document.union(), shape.isGroup shape.isGroupAvailability Flash MX 2004. Usage shape.isGroup Description Read-only property; if TRue, the shape is a group. Example The following example stores the first selected item object in the sel variable and then uses the element.elementType and shape.isGroup properties to determine if the selected item is a group: var sel = fl.getDocumentDOM().selection[0]; var shapeGroup = (sel.elementType == "shape") && sel.isGroup; fl.trace(shapeGroup); See also shape.isDrawingObject shape.verticesAvailability Flash MX 2004. Usage shape.vertices Description Read-only property; an array of Vertex objects (see Vertex object). Example The following example stores the first selected item object in the someShape variable and then shows the number of vertices for that object in the Output panel: var someShape = fl.getDocumentDOM().selection[0]; fl.trace("The shape has " + someShape.vertices.length + " vertices."); |
< Day Day Up > |