I am trying to use http://code.google.com/p/as3svgrendererlib/ in my flash cs 5.5 project to import and load svg files.
I downloaded the swc file from http://code.google.com/p/as3svgrendererlib/downloads/list and linked it in actionscript settings.
I tried compiling the project using the following code:
package {
import flash.display.Sprite;
import flash.display.DisplayObject;
import flash.events.Event;
public class Main extends Sprite {
import flash.net.URLLoader;
import flash.net.URLRequest;
//ProcessExecutor.instance.initialize(stage);
public function Main():void {
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = "text";
myLoader.addEventListener(Event.COMPLETE, xmlComplete, false, 0, true);
myLoader.load( new URLRequest("assets/spring_tree_final.svg"));
}
public function xmlComplete(e:Event):void {
trace("it's finished loading");
var svg:SVGDocument = new SVGDocument();
svg.parse(e.target.data);
addChild(svg);
stage.addChild(svg);
}
}
}
But I kept getting the following error:
- C:\Users\xx\Desktop\load_svg\Main.as, Line 33 1046: Type was not found or was not a compile-time constant: SVGDocument.
- C:\Users\xx\Desktop\load_svg\Main.as, Line 33 1180: Call to a possibly undefined method SVGDocument.
So i checked out the source from http://code.google.com/p/as3svgrendererlib/source/checkout and tried importing it using the following line:
import com.lorentz.SVG.*;
right below the 'import flash.events.Event' line.
But I continue to receive the same errors as before.
What am I missing?