Loading ...
Sorry, an error occurred while loading the content.

Embedding a swf file into SVG doc

Expand Messages
  • huangshan04
    Does anybody know how to embed a swf file in a svg document? What element should be used? Thanks and happy new year.
    Message 1 of 3 , Dec 31, 2008
    • 0 Attachment
      Does anybody know how to embed a swf file in a svg document?
      What element should be used?
      Thanks and happy new year.
    • Cameron McCormack
      ... 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:
      Message 2 of 3 , Dec 31, 2008
      • 0 Attachment
        huangshan04:
        > 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'/>
        </svg>

        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'
        data='file.swf'
        style='width:100px;height:100px'/>
        </foreignObject>
        </svg>

        You probably will have better luck if you convert your WMF to SVG, for
        example by using Batik’s WMFTranscoder class:

        http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.html

        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/
      • Frank Bruder
        ... http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.html ... This was about Shockwave Flash, not Windows
        Message 3 of 3 , Jan 2, 2009
        • 0 Attachment
          --- In svg-developers@yahoogroups.com, Cameron McCormack <cam@...> wrote:
          >
          > huangshan04:
          > > 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'/>
          > </svg>
          >
          > 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'
          > data='file.swf'
          > style='width:100px;height:100px'/>
          > </foreignObject>
          > </svg>
          >
          > You probably will have better luck if you convert your WMF to SVG, for
          > example by using Batik’s WMFTranscoder class:
          >
          >
          http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/transcoder/wmf/tosvg/WMFTranscoder.html
          >
          > 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.


          Regards
          Frank
        Your message has been successfully submitted and would be delivered to recipients shortly.