|
Getting_Started
How to show a SVG file.
Featured IntroductionThe library has classes that represents each SVG element. Those classes and the SVG element has similar properties and styles. The SVGDocument class is the class responsible to hold the SVG display object tree. The library has an asynchronously parser that processes the SVG file and create all necessary display objects. The library also uses deferred rendering. So, the graphics will only have the final rendering after RENDERED event, not after PARSE_COMPLETE event. You can listen to the RENDERED event to know when graphics was completely rendered for the first time. Using the library without the Flex component.1) The first thing you have to do is initialize the ProcessExecutor, that class is responsible to distribute the library processing between frames, that way the application will not get frozen while showing large SVG files. You have to do that only once in the whole application. Example: ProcessExecutor.instance.initialize(stage); 2) You will have to load the SVG file by yourself, with the native class URLLoader. Then you can create an SVGDocument object, that object is the one that parses and show your SVG string. Example: var svg:SVGDocument = new SVGDocument(); svg.parse(myLoadedSVGString); addChild(svg); You can also pass an XML object to the parse method, but it isn't recommended once when the parse method gets a string it does extra things to better parse the string. Using the library with the Flex component.1) Just add the SVG component to your MXML, and set the property "Source" on the component with:
After that, the SVG file will appear on the screen. |