Amazon S3 and Flash widgets

Today, I wanted to load a Flash widget of mine and its corresponding XML configuration file to Amazon S3.

What appeared to be a trivial task turned into 3 hours of struggle with browser cache problems, security issues and other whatnots.

So to summarise what did the job eventually:

*updated to support IE7*

The address of the Flash file is: http://s3.amazonaws.com/bucketname/flashfile.swf

<script language=”javascript”>
if (AC_FL_RunContent == 0) {
alert(“This page requires AC_RunActiveContent.js.”);
} else {
AC_FL_RunContent(
‘codebase’, ‘http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0’,
‘width’, ‘220’,
‘height’, ‘200’,
‘src’, ‘s3.amazonaws.com/bucketname/flashfile’,
‘quality’, ‘high’,
‘pluginspage’, ‘http://www.macromedia.com/go/getflashplayer’,
‘align’, ‘right’,
‘play’, ‘true’,
‘loop’, ‘true’,
‘scale’, ‘showall’,
‘wmode’, ‘window’,
‘devicefont’, ‘false’,
‘id’, ‘flashfile’,
‘bgcolor’, ‘#ffffff’,
‘name’, ‘flashfile’,
‘menu’, ‘true’,
‘allowFullScreen’, ‘false’,
‘allowScriptAccess’,’always’,
‘movie’, ‘s3.amazonaws.com/bucketname/flashfile’,
‘salign’, ”
); //end AC code
}
</script>
<noscript>
<object classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0″ width=”220″ height=”200″ id=”flashfile” align=”right”>
<param name=”allowScriptAccess” value=”sameDomain” />
<param name=”allowFullScreen” value=”false” />
<param name=”movie” value=”s3.amazonaws.com/bucketname/flashfile.swf” /><param name=”quality” value=”high” /><param name=”bgcolor” value=”#ffffff” /> <embed src=”s3.amazonaws.com/bucketname/flashfile.swf” quality=”high” bgcolor=”#ffffff” width=”220″ height=”200″ name=”flashfile” align=”right” allowScriptAccess=”always” allowFullScreen=”false” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer” />
</object>
</noscript>

In order to be able to load the XML and other files, I had to add this to Actionscript (at the beginning of the movie):

System.security.allowDomain( ‘*’ );

This allows cross-domain scripting, of course you can substitute the * with a specific domain name.

Some references: link1, link2

Post Details

Category

Web development

Tags

Date

Author

Leave a Comment