FYI - Macro to embed Swf (Flash file) inside a content page Options
jes133
Posted: Thursday, April 19, 2007 4:19:42 AM
Rank: Enthusiast

Joined: 4/19/2007
Posts: 14
Requirement: Embed a flash document inside a content page using a macro. The Swf file must be specified through a macro parameter.

What this does: Basically this will allow you to embed a flash file just like you would an image inside a content page.

Proposed XSLT: (More than happy to hear other ways of accomplishing this)

Code:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>

<xsl:variable name="flashFile" select="/macro/flashFile" />

<xsl:template match="/">

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="flashControl" align="middle">
<xsl:attribute name="width">
  <xsl:value-of select="/macro/width" />
</xsl:attribute>
<xsl:attribute name="height">
  <xsl:value-of select="/macro/height" />
</xsl:attribute>
<param name="movie">
<xsl:attribute name="value">
  <xsl:value-of select="$flashFile/node/data [@alias='umbracoFile']" />
</xsl:attribute>
</param>
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed quality="high" bgcolor="#ffffff" name="flashControl" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
  <xsl:attribute name="width">
    <xsl:value-of select="/macro/width" />
  </xsl:attribute>
  <xsl:attribute name="height">
    <xsl:value-of select="/macro/height" />
  </xsl:attribute>
  <xsl:attribute name="value">
    <xsl:value-of select="$flashFile/node/data [@alias='umbracoFile']" />
  </xsl:attribute>
</embed>
</object>


</xsl:template>

</xsl:stylesheet>




jHodgkinson
Posted: Friday, April 20, 2007 9:12:15 PM
Rank: Fanatic

Joined: 3/15/2007
Posts: 378
Location: Cary, NC USA
Eli - sounds cool. can you upload .swf files directly into media? i've tried but am getting a "The page cannot be displayed" error when I try to upload. also, I'm using a 3.0 beta...
whogoeson
Posted: Wednesday, January 30, 2008 10:36:40 PM
Rank: Devotee

Joined: 8/10/2006
Posts: 46
Does anyone know if it’s possible to use this code and www.jeroenwijering.com FLV player?
<embed src="/assets/mediaplayer.swf" width="470" height="255" allowscriptaccess="always" allowfullscreen="true" flashvars="height=255&width=470&file=/assets/video.flv&backcolor=0x000000&frontcolor=0xFFFFFF" />

My try goes like this:
Code:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]> 
<xsl:stylesheet   
    version="1.0"   
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   
    xmlns:msxml="urn:schemas-microsoft-com:xslt" 
    xmlns:umbraco.library="urn:umbraco.library" 
    exclude-result-prefixes="msxml umbraco.library"> 
 
 
<xsl:output method="xml" omit-xml-declaration="yes"/> 
 
<xsl:param name="currentPage"/> 
 
<xsl:variable name="flashMovie" select="/macro/flashMovie" />   
 
<xsl:template match="/"> 
 
<xsl:attribute name="width"> 
  <xsl:value-of select="/macro/width" /> 
</xsl:attribute> 

<xsl:attribute name="height"> 
  <xsl:value-of select="/macro/height" /> 
</xsl:attribute> 

<param name="movie">   
<xsl:attribute name="src"> 
  <xsl:value-of select="$flashMovie/node/data [@alias='umbracoFile']" />   
</xsl:attribute> 

</param> 
<param name="quality" value="high" />   
<param name="flashvars" value="height=255&width=470&file=/assets/video.flv&backcolor=0x000000&frontcolor=0xFFFFFF" />   

<embed quality="high" align="middle" allowScriptAccess="always" allowfullscreen="true" flashvars="height=255&width=470&file=/assets/video.flv&backcolor=0x000000&frontcolor=0xFFFFFF">   
  <xsl:attribute name="width"> 
    <xsl:value-of select="/macro/width" /> 
  </xsl:attribute> 

  <xsl:attribute name="height"> 
    <xsl:value-of select="/macro/height" /> 
  </xsl:attribute> 

  <xsl:attribute name="src"> 
    <xsl:value-of select="$flashMovie/node/data [@alias='umbracoFile']" />   
  </xsl:attribute> 

</embed> 
</object> 
 
 
</xsl:template> 
 
</xsl:stylesheet> 
 


But this fails… :blush:
/ Whogoeson
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.