Print this page

Use .swf files greater than 5MB in Visualforce pages with tag

Knowledge Article Number 000212155
Description
According to the documentation on <apex:flash> - (http://www.salesforce.com/docs/developer/pages/Content/pages_compref_flash.htm), you can use the 'src' attribute to specify a path to the movie to be displayed, expressed as a URL. Alternatively, you can store a Flash movie as a static resource and specify the 'src' attribute to the resource path as follows:

<apex:flash src="{!$Resource.<name of resource>}" height="200" width="600"  id="myFlashMoive"/>  

Currently however, there is a size limit on static resources of 5MB, so what can you do instead of static resources?
Resolution
To display a .swf file via Documents, you must first take some necessary steps in your org setup to ensure the .swf file plays correctly on page load. 

In Salesforce, the HTTP header of a servlet.FileDownload's response contains 'Content-Disposition:attachment', however as of Flash version 10.0.2 (http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes.html#head32), if Adobe's Flash player sees a "Content-Disposition: attachment" header while downloading a .swf file, it will ignore the .swf file rather than play it. To avoid this issue, you can reconfigure the download settings for .swf files (Setup | Security | File Upload and Download Security) from 'Download' to 'Hybrid'.

If you then upload the .swf file to Documents and implement the following Visualforce page, you can successfully use .swf files stored in Documents via the Visualforce tag <apex:flash>, allowing for .swf files greater than 5MB in size:

<apex:page > 
   <apex:flash src="/servlet/servlet.FileDownload?file=<DocumentId>" height="300" width="100%" /> 
</apex:page> 




promote demote