Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Amar 11 posts 41 karma points
    Jul 22, 2009 @ 09:38
    Amar
    0

    How to insert .swf (flash file) to umbraco

    subject : how to insert .swf file to umbraco template.

    [color=blue]Hi Friends,

    Thanks in advance.

    I am very new to umbraco. I have just started doing few things.
    I have one requirement where I need to show flash animation on page.

    I have one .swf file which i need to display on the page.
    Please tell me step by step process in detail.

    I seen few answers on the forum, but they are in too much details and I could not able to get anything out of that.
    If any video tutorial is available please share the link.

    Hoping the realiest response.[/color]

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 22, 2009 @ 10:12
    Peter Dijksterhuis
    1

    Please tell us a bit more.

    Have you checked out Warren's package (CWS), that holds a ton of examples how you can get things done. http://our.umbraco.org/projects/

    Do you only have 1 swf-file?

    Does the swf-file need to be editable by the end-users in the future?

  • Seth Niemuth 275 posts 397 karma points
    Jul 22, 2009 @ 12:08
    Seth Niemuth
    100

    You can either add your embed swf code (probably something similar to this: <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="Yourfilename" ALIGN="">

    <PARAM NAME=movie VALUE="Yourfilename.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#333399> <EMBED src="Yourfilename.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="Yourfilename" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT> )

    1. To either your template directly, or (2) you could create a macro (in the developer section) and have the XSLT for the macro contain your code. You could also create a parameter for your macro so that you can specify the location of the SWF and pass that to your XSLT. Then, you can add the macro in the rich text editor on whichever page (s) you want.

    The easiest will be to add it to your template which will be in your settings section.

  • dandrayne 1138 posts 2262 karma points
    Jul 22, 2009 @ 12:47
  • Amar 11 posts 41 karma points
    Jul 23, 2009 @ 08:15
    Amar
    0

    Hi Sniemuth,

    Where do I need to paste the .swf file.

    do I need to embed this <object tag> in <umbraco: macro> or any other tag.

    Can you please paste the XSLT ... if I do need to create a macro.

    I have copied the tag you metioned .. but it is not playing the file.

     

  • Amar 11 posts 41 karma points
    Jul 23, 2009 @ 08:19
    Amar
    0

    Hi Peter,

    I have only one .swf file to be played without any user interaction.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 23, 2009 @ 10:29
    Jan Skovgaard
    2

    Hi Amar

    To make things easy I would do the following

    1: Add an upload property to the document type (Which I imagine is maybe the one used for your frontpage?)

    2: Upload your .swf in the content area on the specific document type

    3: Create an XSLT macro, which looks like this (please notice that the code used is almost the same as the post ddrayne mentions above)

     <?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="html" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:variable name="swfFile" select="$currentPage/data [@alias='yourSwfFile']"/>

    <!-- ============================================================= -->

    <xsl:template match="/">
    <div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
    <script type="text/javascript" src="/scripts/swfobject.js"></script>
    <script type="text/
    javascript">
    <![CDATA[
    // Previous JavaScript code
    var path = "]]><xsl:value-of select="$yourSwfFile" /><![CDATA[";
    var videowidth = "]]>500<![CDATA[";
    var videoheight = "]]>100<![CDATA[";
    // Rest of JavaScript code
    var s1 = new SWFObject(path,"Pindar SWF",videowidth,videoheight,"9","#FFFFFF");
    s1
    .addParam("allowfullscreen","true");
    s1
    .addParam("allowscriptaccess","always");
    s1
    .addParam("wmode","transparent");
    s1
    .write("container");
    ]]>
    </script>


    </xsl:template>
    <!-- ============================================================= -->

    Remember that this requires the swfobject.js

     

    Hope that this makes sense and solves your problem.

    /Jan

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 23, 2009 @ 10:33
    Jan Skovgaard
    0

    If you don't want to do it with the option for uploading the .swf file to the document, which is using the .swf file you could also just hardcode it into your template instead. Then you would just need to write the following into your template.

    <div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
    <script type="text/javascript" src="/scripts/swfobject.js"></script>
    <script type="text/
    javascript">
    // Previous JavaScript code
    var path = "]]>http://yourdomain.com/swf/yourswffile.swf<![CDATA[";
    var videowidth = "]]>500<![CDATA[";
    var videoheight = "]]>100<![CDATA[";
    // Rest of JavaScript code
    var s1 = new SWFObject(path,"Pindar SWF",videowidth,videoheight,"9","#FFFFFF");
    s1
    .addParam("allowfullscreen","true");
    s1
    .addParam("allowscriptaccess","always");
    s1
    .addParam("wmode","transparent");
    s1
    .write("container");
    </script>

     

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft