visualforce : apex:flash with https
Today I came across a problem when using The application that I am building is on sites using https. I need to include some flash. It is very easy to do with apex:flash, add the src, a height and width and it is done. The problem occurred when I tested in IE. What happens is that apex:flash includes the adobe cab from macromedia over http. The documentation does not providea method to force https.
A quick trip to the community site found a number of posts with similar problems. I found my inspiration on the blog post titled ‘Integrating Flex into Visualforce Pages‘ by Ryan Marples. This was posted no more than three weeks ago. There are some similarities but also differences.
I wrote a custom component which allows for switching between http/https as needed. The component is as follows:
<apex:component >
<apex:attribute name="flashvars" required="false" type="string" description="The flashvars attribute
can be used to import root level variables to the movie. All variables are created before the first frame of the SWF is played.
The value should consist of a list of
ampersand-separated name-value pairs." />
<apex:attribute name="height" required="true" type="integer" description="The height at which this
movie is displayed, expressed either as a relative percentage of the total available vertical
space (for example, 50%) or as a number of pixels (for example, 100)." />
<apex:attribute name="id" required="false" type="string" description="An identifier that allows the component
to be referenced by other String components in the page." />
<apex:attribute name="loop" required="false" type="boolean" description="A Boolean value that specifies
whether the flash movie plays repeatedly or just once. If set to true, the flash movie plays repeatedly. If not specified,
this value defaults to false." />
<apex:attribute name="play" required="false" type="boolean" description="A Boolean value that specifies
whether the flash movie automatically begins playing when displayed. If set to true, the flash movie
automatically begins playing. If not specified, the value defaults to false." />
<apex:attribute name="rendered" required="false" type="boolean" description="A Boolean value that specifies
whether the component is rendered on the page. If not specified, this value defaults to true." />
<apex:attribute name="src" required="true" type="string" description="The path to the movie displayed,
expressed as a URL. Note that a flash movie can be stored as a static resource in Salesforce." />
<apex:attribute name="width" required="true" type="integer" description=" The width at which this movie is
displayed, expressed either as a relative percentage of the total available horizontal space (for example, 50%) or as a
number of pixels (for example, 100)." />
<apex:attribute name="https" required="false" type="boolean" description="use SSL codebase" />
<apex:outputPanel layout="none" rendered="{!if(rendered != false,true,false)}">
<apex:outputPanel layout="none" rendered="{!if(https != true,true,false)}" layout="none">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" height="{!height}" width="{!width}" id="{!id}">
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!if(https != true,false,true)}" layout="none">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" height="{!height}" width="{!width}" id="{!id}">
</apex:outputPanel>
<param name="movie" value="{!src}" />
<param name="FlashVars" value="{!flashvars}" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed align="middle" allowScriptAccess="sameDomain"
bgcolor="#869ca7" {!if(loop=true,'loop=true','loop=false')} {!if(play=true,'play=true','play=false')}
pluginspage="http://www.adobe.com/go/getflashplayer" quality="high" src="{!src}"
type="application/x-shockwave-flash" width="{!width}" height="{!height}">
</embed>
</object>
</apex:outputPanel>
</apex:component>
I implemented all of the original attributes, including their required status, from the documentation.
Usage:
<c:flash src="PATH/TO/SWF.swf" width="400" height="400" https="true" play="true" loop="true" />
Comments
- tcyuermef
JBfRjp <a href="http://mcvgbntpxzgo.com/">mcvgbntpxzgo</a>, [url=http://hlsalvcofrxk.com/]hlsalvcofrxk[/url], [link=http://jrcbjifyipbh.com/]jrcbjifyipbh[/link], http://siszckfjncmo.com/
- March 15, 2010, 2:58 AM
- ixqtojbdga
W9r27w <a href="http://tgyuocsjjkcn.com/">tgyuocsjjkcn</a>, [url=http://zphuszrylnpr.com/]zphuszrylnpr[/url], [link=http://idodlrdleldx.com/]idodlrdleldx[/link], http://sppnyrrmzfto.com/
- March 15, 2010, 7:51 AM
- padma
http://www.cheapcarinsurancesource.com/ cheap car insurance pyba http://www.cheapautosinsurance.net/ cheap auto insurance frb http://www.funfanfic.com/ cheap home insurance ulh http://www.getcheaphealthinsurance.net/ health insurance 9811
- March 19, 2010, 12:06 AM
- tabeloverskrift
http://www.cheapcarinsurancesource.com/ car insurance 8-]]] http://www.hellzyea.com/home home insurance :PPP http://www.getcheaphealthinsurance.net/ health insurance quotes ivek
- March 20, 2010, 10:26 AM
- fanclub
http://www.hellzyea.com/home home insurance mmjxq http://www.getcheaphealthinsurance.net/ cheap health insurance =-) http://www.owegofd.com/ life insurance >:DDD
- March 20, 2010, 3:34 PM
- lidia
http://www.newenglandpatriotsblog.net/ health insurance quotes :-]] http://www.hellzyea.com/health health insurance quotes 9994 http://www.hellzyea.com/life life insurance quotes %-]] http://www.hellzyea.com/home home insurance 8(((
- March 25, 2010, 2:16 PM