Home

Embedding a SVG file

Thursday, August 17th, 2006 | Author: dehash

SVG file drawn using Inkscape and embedded in swf at compile time. The box at bottom left had a radial gradient fill in the svg that does not appear in the swf.

SVGEmbed.as code below compiled using FlashDevelop and a Bit-101 template

Actionscript:
  1. package {
  2. import flash.display.Sprite;
  3. public class SVGEmbed extends Sprite {
  4. [Embed(source="../assets/plainsvg1.svg")]
  5. private var SimpleSVG:Class;
  6.  
  7. public function SVGEmbed() {
  8. init();
  9. }
  10. private function init():void {
  11. var mySVG:Sprite = new SimpleSVG();
  12. mySVG.scaleX=0.5;
  13. mySVG.scaleY=0.5;
  14. addChild(mySVG);
  15. }
  16. }
  17. }

Tags »

 | Comments Feed: RSS 2.0
Category: Code Examples, Flash, Flex SVG

You can leave a response.

2 Responses

  1. 1
    Chris 

    I have the same problem. Anyone know how to fix this? I want my gradients to show up in flex!

  2. 2
    Joe 

    Thanks, this was just what I was looking for!

Leave a Reply

CAPTCHA Image