Swiffy Conversion Error (Flash to HTML5)

6.3k Views Asked by At

I've converted a Flash SWF file to HTML5 using Google Swiffy.

This works fine in Firefox.

However, in IE8, I'm receiving these errors:

'swiffy' is undefined

'stage' is null or not an object

In IE, if you visit the Google Swiffy gallery section (http://www.google.com/doubleclick/studio/swiffy/gallery.html), and click on any of the examples, you'll receive similar errors (or, at least, I do). So maybe this is an existing issue.

I'll also contact Google to see if there's a solution to this issue.

Here's a snippet of the code.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Swiffy output</title>
<script src="http://www.gstatic.com/swiffy/v3.5/runtime.js"></script>
<script>swiffyobject = {"tags":
[{"id":1,"height":194,"width":609,"data":"data:image/jpeg;
base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkS

...there's a lot of converted code, most of it looks like the gibberish above...

</script>
</head>
<body style="overflow:hidden;margin:0;">

<script>var stage = new swiffy.Stage(document.body, swiffyobject);</script>
<script>stage.start();</script>

</body>
</html>

I did begin converting the Flash file by coding it myself using Canvas. I'll probably continue with it. I was just pressed for time to get this done, and would like to have these errors resolved.

Thanks.

Stephen

(BTW, can I attach a file? The code is really lengthy.)

3

There are 3 best solutions below

0
On BEST ANSWER

This is because HTML5 Canvas is not supported in IE8

You could use the excanvas library but it is horrible with animation. excanvas uses VML to emulate canvas commands and pretend that it works on IE7/8

excanvas has not been updated since 2009 and I really recommend against supporting IE8 if you want to use Canvas. It's possible an SVG/VML solution would be better, depending on what you're doing.

1
On

This is the solution: Download the swfobject.js and keep this file in folder "scripts".

Put this code in header section:

<script type="text/javascript" src="http://www.mysite.com/scripts/swfobject.js"></script>

in swiffy file put this (bellow swiffy script):

<script type="text/javascript">swfobject.embedSWF("http://www.mysite.com/flash_files/myflash.swf", "swiffycontainer", "638", "500", "8.0.0", "myflash.swf", {}, {menu:"false", scale:"noscale", wmode:"transparent"}, {} ); </script>
1
On

The above (using swfobject.js) is a good solution! Basically use the swf in Flash supported env and HTML fallback in case of others.