import com.itechnica.svg.PathToArray; import mx.utils.Delegate; /** * Created by Helen Triolo for flash-creations.com as an example of using PathToArray * Notes at http://flash-creations.com/notes/sample_svgtoflash.php * Reads an SVG file and draws the object in movieclip holder * Last updated 26 Jan 2006 to include alternate paths assignment */ var x:XML = new XML(); x.ignoreWhite = true; var nPathNodes:Number; var thisPath:Number; var paths:Array; var conv:PathToArray; function xmlLoaded(gotit:Boolean) { if (gotit) { msg.text = ""; // uncomment the path assignment that is right for your file: // if your SVG file includes tags, use this line: paths = x.firstChild.firstChild.childNodes; // if your SVG file includes no tags, use this line instead: // paths = x.firstChild.childNodes; nPathNodes = paths.length; getShapes(0); } else { trace("couldn't read xml"); } } // calls itself til all paths have been read and displayed function getShapes(iPath:Number) { var dCmds:Array = new Array(); var d:Array; var dp:Array; conv = new PathToArray(paths[iPath], dCmds); // draw the shapes in clips in holder movieclip holder.createEmptyMovieClip("p"+iPath, iPath+1); for (var i:Number=0; i