SVG to Flash

amitaibu's picture

Hi,
I'm creating designs in SVG, and I'd like to show them on my site. I'd like to convert it into flash. I saw different converted such as SVG 2 SWF .

Does anyone has experience in that?

Comments

What Flash Player version you trying to hit?

Chris Charlton's picture

Flash Player can load several (display) formats, including GIF, JPEG, PNG, SVG, and SWF files. You can import all but SVG at runtime using the Image control.

Here's some SVG points from Flash Player docs (You should be aware of the following restrictions when working with SVG files in Flex):
* You can only embed an SVG file in an application; you cannot load one at run time
* SMIL and animation are not supported
* Masking and filters are not supported
* Pattern Fill and some advanced Gradients are not supported
* Interactivity and scripting is not supported
* SVG text is rendered as nonsearchable and nonselectable SWF shape outlines, meaning it is not rendered as native text in Flash Player

For runtime loading, check out: http://code.google.com/p/as3svgrendererlib/

Chris Charlton, Author & Drupal Community Leader, Enterprise Level Consultant

I teach you how to build Drupal Themes http://tinyurl.com/theme-drupal and provide add-on software at http://xtnd.us

Thanks for the

amitaibu's picture

Thanks for the answer...
Flash player - is this a module? I couldn't find it, can you please send a link.

Cheers!

not a module, the plug-in

Chris Charlton's picture

Not a module, but "Flash"... you know, Flash Player (the plug-in we all install into our browsers).

:)

Chris Charlton, Author & Drupal Community Leader, Enterprise Level Consultant

I teach you how to build Drupal Themes http://tinyurl.com/theme-drupal and provide add-on software at http://xtnd.us

Oh ;) I get it. Is there a

amitaibu's picture

Oh ;) I get it. Is there a Drupal module that already does this job?

Ugly conversion job

dwees's picture

Since like he says the SVG file have to be embedded in the Flash files, it means you need a conversion tool from SVG to Flash, which is something a Drupal module isn't going to be up to. The best conversion tool in Drupal for Flash (from various video formats) is the FlashVideo module which takes some work to get set up.

A quick Google search leads the following possibly useful result:

http://robla.net/1996/svg2swf/

Also I seem to remember reading something about someone who was converting inline svg on canvas elements using JavaScript.

Dave

deng will display native svg

sime's picture

http://deng.com.br/
ie. it's flash file you pass flash into it.

This is something I've wanted to play with for ages, so please let me know if you try it.

re: This is hot!

dwees's picture

That definitely looks like what he wants. Now all he'll need is a way to interface his SVG files simply into the framework. I suspect this actually surprisingly easy, probably we'll need to create a filter module. Cool as heck!

Dave

If I was a true Marketeer,

sime's picture

If I was a true Marketeer, I'd say use swftools which has a filter and Deng is the next tool I want to integrate. But swftools has some problems that I need to rectify (mainly everything crammed into one module).

Sweet...

amitaibu's picture

Well, since I'm not a developer excuse me if I'm speaking nonsense, but dwees, when you say filter do you mean something that can be used by custom filter module - i.e. some markup that will 'tell' drupal to take the file and convert it to flash?
And the use the SWFtools to show it?

I know it was directed at

sime's picture

The Q. wasn't directed at me, but custom filter would be a fine solution IMO.

The consideration with flash is whether to do Flash replacement for IE users. SWF Object is a good choice, and there are a couple of small modules that help with that.

(In context, SWF Tools was trying to make all the implementations of SWF Object and other related Flash techniques redundant, but hasn't succeeded at this stage.)

Might actually have to code the filter

dwees's picture

We might actually code this filter ourselves.

What I was thinking was something similar to the Geogebra module.

Workflow:

  1. Enable the upload module.
  2. You would create a content type, maybe call it 'comic' and mark this content type as 'uploads enabled'
  3. You would navigate to a settings page and select this content type.
  4. You would navigate to node/add/comic and a form would show up.
  5. You would first upload your svg file using the upload module.
  6. Somewhere in the body of your node you would write something like:
    [svg]filename.svg[/svg]
    where the filename.svg was the file you uploaded.

If someone wants to grab the Geogebra module from the downloads and modify it to suit their needs that would be fine by me. Basically it embeds Java applets, which is not what we want, we want to drupal_add_js() the script provided by Deng, or use the SWFTools module to do this.

Dave

How about a CCK SVG field,

amitaibu's picture

How about a CCK SVG field, rather then only a filter?

CCK SVGField

turadg's picture

I'd also like to see an SVGField for CCK. There's talk of one in the comments on this blog post,
http://www.latenightpc.com/blog/archives/2008/10/16/drupal-svg-display-m...

The Geo module also has some relevant code,
http://drupal.org/node/383534

No progress in months though. Seems like it would be useful to many, especially since SVG now works in 95% of installed browsers. (http://code.google.com/p/svgweb/)

re: noticed my browser caching the SWF

dwees's picture

I notice my browser caches the SWF so only the first load takes any time. Maybe it's a good idea to include a very small example on the front page of your website ( or on any entry page ) so that users will have this cached for the next time they view the SVG images?

Dave