--- In email@example.com
, Cameron McCormack <cam@...> wrote:
> > Does anybody know how to embed a swf file in a svg document?
> > What element should be used?
> I donât know of any user agent that supports rendering WMF inside SVG.
> If your SVG user agent supported WMF natively, you should be able to do:
> <svg â¦>
> <image xlink:href='file.swf' width='100' height='100'/>
> If your SVG user agent supports WMF in HTML somehow, then you might be
> able to do:
> <svg â¦>
> <foreignObject width='100' height='100'>
> <object xmlns='http://www.w3.org/1999/xhtml'
> You probably will have better luck if you convert your WMF to SVG, for
> example by using Batikâs WMFTranscoder class:
> I donât think it is exposed through the command-line transcoder
> application yet, unfortunately.
> > Thanks and happy new year.
> Cameron McCormack â http://mcc.id.au/
This was about Shockwave Flash, not Windows Metafile. No user agent
supports swf natively. Answer number two, an xhtml object tag inside a
foreignObject tag is correct. If supported by the user agent this
gives us the full power of plugin technology we can use in HTML. But I
don't suppose that foreignObject would work if the SVG user agent is
itself a plugin, so this wouldn't work in Internet Explorer. All the
major browsers with native SVG support do support foreignObject.
Theoretically, the image tag, or in SVG 1.2 the animation tag, does
not need to rely on native support. They could reference anything, and
user agents are free to use plugins for rendering whatever they
reference. I don't know for sure, but I don't think browsers do this
yet, so we'll have to use foreignObject and the xhtml object tag. But
that's just an overtly complicated way of writing answer number one.
Note the redundancy. Width and height are set in both the
svg:foreignObject element, and the xhtml:object element. One could use
an XSL Transformation to automatically replace image and animation
elements with xlink:type="application/x-shockwave-flash" with the
foreignObject + xhtml:object solution.
Conversion to SVG is also an option. I'm sure there exist projects
working at SWF to SVG conversion. Translating all script and animation
would be a lot, however. If working conversion tools exist, they are
probably very limited.