To render SVG in Flex

How I can load an SVG to setting image source property dinamicaly?
In the code attached there are two case: the first where I used the bindable var works but the second where I set the property source doesn't work.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" layout="absolute" applicationComplete="onComplete()">
			private var svg:Class;
			private function onComplete():void
				image2.source = "@Embed(source='../images/MB1.svg')";
	<mx:Image id="image1" source="{svg}" x="42" y="21" width="206" height="218"/>
	<mx:Image id="image2" x="42" y="278" width="206" height="229"/>

Open in new window

Who is Participating?
Gary BenadeConnect With a Mentor Commented:
From your demo svg file I have made the assumption based on the fact that your SVG was generated from a PDF that what you are ultimately trying to do is show a PDF in flex.
The solution may be as simple as converting to SWF instead of SVG
Gary BenadeCommented:
There are free 3rd party svg rendering libraries available:
rfedericoniAuthor Commented:
I don't need 3rd party libraries because SVG it's natively supported by Flex 3.. my problem it's to understand how utilise it.
rfedericoniAuthor Commented:
The solution it's this:
Flex supports importing GIF, JPEG, PNG, and SWF files at run time, and embedding GIF, JPEG, PNG, SVG, and SWF at compile time.
Gary BenadeCommented:
That's not the solution, that's the problem. I am well aware of the limitations of flex's native SVG support but just because something isn't supported out of the box doesn't mean it can't be done. The link above is one of the many solutions being developed by third parties, you just need to look around a bit.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.