5 Replies Latest reply on May 31, 2011 1:38 AM by blazejewicz

    Minimum actionscript code to display an svg image on screen.


      I've been making flash games with pngs for a while, but I can't get svgs to display.

      I'm using the same code I used for pngs, but modified it for SVGs, in hope for a performance boost.

      I used to use a back buffer with bitmaps and a canvas, but got rid of that stuff from my code


      // svgEmbed.as



      import flash.display.DisplayObject;

      import flash.display.Sprite;

      [SWF(width="200", height="200")]

      public class svgEmbed extends Sprite


      [Embed(source='ball1.svg', mimeType='image/svg')]

      public static var EmbeddedSVG:Class;

      public static var svg:DisplayObject = DisplayObject( new EmbeddedSVG());



      My class GameObject extends Sprite

      There is a DisplayObject type member variable in this class.


      elsewhere i use:

      new GameObject.startupGameObject(svgEmbed.svg)

      A method in this GameObject uses addChild with the Display Object


      aaand, its not displaying.

      so what would be the shortest code to display an svg so i can learn from that, or what is wrong with my code