< Day Day Up > |
Availability Flash MX 2004. Description A Contour object represents a closed path of half edges on the boundary of a shape. Method summary for the Contour objectYou can use the following method with the Contour object:
Property summary for the Contour objectYou can use the following properties with the Contour object:
contour.getHalfEdge()Availability Flash MX 2004. Usage contour.getHalfEdge() Parameters None. Returns A HalfEdge object. Description Method; returns a HalfEdge object on the contour of the selection. Example This example traverses all the contours of a selected shape and shows the coordinates of the vertices in the Output panel: // with a shape selected var elt = fl.getDocumentDOM().selection[0]; elt.beginEdit(); var contourArray = elt.contours; var contourCount = 0; for (i=0; i<contourArray.length; i++) { var contour = contourArray[i]; contourCount++; var he = contour.getHalfEdge(); var iStart = he.id; var id = 0; while (id != iStart) { // get the next vertex. var vrt = he.getVertex(); var x = vrt.x; var y = vrt.y; fl.trace("vrt: " + x + ", " + y); he = he.getNext(); id = he.id; } } elt.endEdit(); contour.interiorAvailability Flash MX 2004. Usage contour.interior Description Read-only property; the value is true if the contour encloses an area; false otherwise. Example This example traverses all the contours in the selected shape and shows the value of the interior property for each contour in the Output panel: var elt = fl.getDocumentDOM().selection[0]; elt.beginEdit(); var contourArray = elt.contours; var contourCount = 0; for (i=0; i<contourArray.length; i++) { var contour = contourArray[i]; fl.trace("Next Contour, interior:" + contour.interior ); contourCount++; } elt.endEdit(); contour.orientationAvailability Flash MX 2004. Usage contour.orientation Description Read-only property; an integer indicating the orientation of the contour. The value of the integer is -1 if the orientation is counterclockwise, 1 if it is clockwise, and 0 if it is a contour with no area. Example The following example traverses all the contours of the selected shape and shows the value of the orientation property of each contour in the Output panel: var elt = fl.getDocumentDOM().selection[0]; elt.beginEdit(); var contourArray = elt.contours; var contourCount = 0; for (i=0; i<contourArray.length; i++) { var contour = contourArray[i]; fl.trace("Next Contour, orientation:" + contour.orientation); contourCount++; } elt.endEdit(); |
< Day Day Up > |