Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

To render SVG in Flex

Posted on 2008-10-30
5
Medium Priority
?
4,854 Views
Last Modified: 2013-11-11
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="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>

Open in new window

MB1.jpg
0
Comment
Question by:rfedericoni
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Gary Benade
ID: 22866645
There are free 3rd party svg rendering libraries available:
http://code.google.com/p/as3svgrendererlib/
0
 

Author Comment

by:rfedericoni
ID: 22867308
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.
0
 

Author Comment

by:rfedericoni
ID: 22902454
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.
0
 
LVL 19

Expert Comment

by:Gary Benade
ID: 22902518
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.
0
 
LVL 19

Accepted Solution

by:
Gary Benade earned 1500 total points
ID: 22903121
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

http://www.swftools.org/
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to record live broadcast.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question