function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bdensmorebdensmore 

Calling swf file from attachment

I'm storing some information in a flashpaper .swf file that gets uploaded as an attachment for a contact.

How can I reference that .swf from within the <apex:flash> tag? I tried creating a custom controller and calling the attachment but that didn't seem to work.

Thanks,
Ben
dchasmandchasman
irst I have to ask why you are using Attachments for this instead of the usually more appropriate Static Resource feature? If you must use attachments for some reason the following sample should get you going:

Code:
<apex:page standardController="Contact" showHeader="false">
    <apex:repeat value="{!contact.attachments}" var="a">
        <apex:flash src="/servlet/servlet.FileDownload—file={!a.id}" 
height="300" width="100%" rendered="{!contains(lower(a.name), '.swf')}"/> </apex:repeat> </apex:page>

Notice that I have added a rendered attribute to make sure we only try to display things that at least have .swf in the original filename.


bdensmorebdensmore
The reason I'm using an attachment is because I am taking a word doc that is being uploaded to a server outside of salesforce and converting it to flashpaper, I'm then uploading the file through the API as an attachment.

I'm still really new to doing SF development so I wasn't even aware of using static resources. I'll take a look at that and see if I can go that route.

Thanks for the help.

Ben
dchasmandchasman
Does the external server that is doing the conversion also store the resulting swf? If so is that server visible via the internet? If yes to both then why not just reference the swf from the external server location?
bdensmorebdensmore
Thanks for your help. That seems to work. The only weird thing is the .swf loads but it always just shows the flash paper logo and never loads the contents of the .swf file. Is there any known issues with displaying a flash paper .swf file?
Ron HessRon Hess
if you open the swf in the browser does it show up correctly?

what version of flash do you have installed, which browser?


bdensmorebdensmore
Yes, i can view the .swf through the browser. If I look at the visual force page in IE it seems to show up fine. In Firefox 3 and Safari only the flash paper logo shows up. It never seems to render the actual page.

I'm wondering if there is a security issue in Firefox and Safari that IE bypasses.
Ron HessRon Hess
what version of flash player is installed in your firefox?
what version of flash player is installed in your safari?

if you update, does the swf show up.

the point is that visualforce is not interacting with the swf contents, rather the swf is interacting with the flash player in your browser.



Message Edited by Ron Hess on 07-16-2008 12:55 PM
bdensmorebdensmore
I think I narrowed down the issue to the visualforce page adding the attachment as a non-secure item. When I'm in IE I get a message that there are both secure and non-secure items on the page. But in Firefox the .swf just doesn't show up. I belive firefox will block content if it's in a secure environment and there are non-secure items.

Is there a way to have the attachment pull from a secure location? I would think since the attachment is in salesforce that it would be considered part of the https call.