Solved

To render SVG in Flex

Posted on 2008-10-30
5
4,829 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 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SWF won't scale? 4 530
AWAY 3d Using BitMapCubeTexture 1 425
Failed download 57 581
Begin mp4 video on first frame 6 184
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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 what frame rate is, how to control it and what effect it has on the video.

733 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