rfedericoni
asked on
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.
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="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="onComplete()">
<mx:Script>
<![CDATA[
[Embed(source='../images/MB1.svg')]
[Bindable]
private var svg:Class;
private function onComplete():void
{
image2.source = "@Embed(source='../images/MB1.svg')";
}
]]>
</mx:Script>
<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"/>
</mx:Application>
MB1.jpg
ASKER
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.
ASKER
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.
Flex supports importing GIF, JPEG, PNG, and SWF files at run time, and embedding GIF, JPEG, PNG, SVG, and SWF at compile time.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://code.google.com/p/as3svgrendererlib/