Copied to clipboard

Flag this post as spam?

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


  • Vincent Ashby-Smith 67 posts 196 karma points
    Jul 14, 2009 @ 14:45
    Vincent Ashby-Smith
    0

    Inserting flash by end users

    Hi all wonder if someone can help. I have the ability to add a flash file (using a macro) in that specific template, however i want the ability for the end user to be able to select the flash file in the content section, through something like a media picker. I've searched the forum but there doesn't seem to be any examples of this. Any ideas?

  • dandrayne 1138 posts 2262 karma points
    Jul 14, 2009 @ 14:53
    dandrayne
    101

    Here's xslt for a macro that does this for swf files stored in the media library

    <?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="videonode" select="/macro/SettingsNode"/>
    <xsl:variable name="videopath" select="$videonode/node/data[@alias='Video']"/>
    <xsl:variable name="videoheight" select="$videonode/node/data[@alias='VideoHeight']"/>
    <xsl:variable name="videowidth" select="$videonode/node/data[@alias='VideoWidth']"/>

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

    <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="$videopath" /><![CDATA[";
    var videowidth = "]]><xsl:value-of select="$videowidth" /><![CDATA[";
    var videoheight = "]]><xsl:value-of select="$videoheight" /><![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>
    <!-- ============================================================= -->

    </xsl:stylesheet>

    it uses swfobject.js for flash insertion, and has macro parameters for the video (using mediacurrent macro parameter) and height and width

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 14, 2009 @ 15:03
    Jan Skovgaard
    0

    Hi Vincent

    You just need to add a media picker property to your textpage or whatever document type it is you want your end users to select the media from.

    Just add a property to the document type lise this

    Name: Choose flash media

    Alias: flashMedia

    Type: Media picker

    And that's it.

    Then you should be able to make full use of the XSLT provided by ddrayne.

    /Jan

  • dandrayne 1138 posts 2262 karma points
    Jul 14, 2009 @ 15:06
    dandrayne
    0

    This one kinda relies on mediacurrent macro parameter (mediapickers ugly sister) but with a small bit of tweakage could be used with a mediacurent on a document type.  using a macro does allow the end user to choose where on the page it goes, and can adjust sizes without clogging up the document type screen.

    Lots of ways to do it though!

  • Vincent Ashby-Smith 67 posts 196 karma points
    Jul 14, 2009 @ 16:38
    Vincent Ashby-Smith
    0

    Hi guys thanks for the replies, how would i change the macro so that it could be used on a document type? As i said above i currently have the macro working when inserting into a template, but for most end users the idea of templates scares them, so they need to be able to select the flash file from the media section. The flash file will never need to change position on the page or will it change width or height. Just they want to ability to switch out a flash header file from say flashA to flashB.

  • dandrayne 1138 posts 2262 karma points
    Jul 14, 2009 @ 17:23
    dandrayne
    1

    Just go to the developer section, and check "use in editor" beside the macro (and turn "render in editor" off)

  • Vincent Ashby-Smith 67 posts 196 karma points
    Jul 14, 2009 @ 17:36
    Vincent Ashby-Smith
    0

    Cheers ddrayne that does the trick!!

  • Amir Khan 1287 posts 2744 karma points
    Jul 15, 2009 @ 05:48
    Amir Khan
    0

    I'm trying to use this module, this is my 1st time working with Umbraco. I've done the following:

    created a Macro calle "Flash Media Picker" alias "flashMedia" using the xslt file above.

    Then put the following code in my template: <umbraco:Macro Alias="flashMedia" runat="server"></umbraco:Macro>

    And i also made a tab called "FlashMediaPicker" of type media picker, uploaded a flash file and published it.

    Could someone tell me what I'm missing here to get this to work?

     

  • Amir Khan 1287 posts 2744 karma points
    Jul 15, 2009 @ 05:49
    Amir Khan
    0

    I'm trying to use this module, this is my 1st time working with Umbraco. I've done the following:

    created a Macro calle "Flash Media Picker" alias "flashMedia" using the xslt file above.

    Then put the following code in my template: <umbraco:Macro Alias="flashMedia" runat="server"></umbraco:Macro>

    And i also made a tab called "FlashMediaPicker" of type media picker, uploaded a flash file and published it.

    Could someone tell me what I'm missing here to get this to work?

     

  • Tom Maton 387 posts 660 karma points
    Aug 06, 2009 @ 14:17
    Tom Maton
    0

    Hi,

    I have tied this but keep on getting "SWFObject is not defined" error message.

    Any ideas?

    Thanks

    Tom

  • dandrayne 1138 posts 2262 karma points
    Aug 06, 2009 @ 15:34
    dandrayne
    0

    You'll need to include swfobject.js from http://blog.deconcept.com/swfobject/, then it should "just work" ;-)

  • Amir Khan 1287 posts 2744 karma points
    Oct 07, 2009 @ 06:17
    Amir Khan
    0

    I'm still unable to get this to work, I've created a macro with the above code, created a media picker node in my doctype, nothing. Am I missing something fundamental here?

  • Amir Khan 1287 posts 2744 karma points
    Oct 07, 2009 @ 16:17
    Amir Khan
    0

    Here is the XSLT code for the version of SWFobject i'm using, I need it so modals work over embedded flash.

     

    I'm getting the error: Error occuredSystem.Xml.XmlException: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 23, position 85.

    Any thoughts?

     

    <?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="videonode" select="/macro/SettingsNode"/>
    <xsl:variable name="videopath" select="$videonode/node/data[@alias='Video']"/>
    <xsl:variable name="videoheight" select="$videonode/node/data[@alias='VideoHeight']"/>
    <xsl:variable name="videowidth" select="$videonode/node/data[@alias='VideoWidth']"/>

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

    <xsl:template match="/">

    <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="]]><xsl:value-of select="$videowidth" /><![CDATA[" height="]]><xsl:value-of select="$videoheight" /><![CDATA[">
    <param name="movie" value="]]><xsl:value-of select="$videopath" /><![CDATA[" />
    <param name="quality" value="high" />
    <param name="wmode" value="transparent" />
    <param name="swfversion" value="6.0.65.0" />
    <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
    <param name="expressinstall" value="/scripts/expressInstall.swf" />
    <param name="loop" value="false" />
    <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="]]><xsl:value-of select="$videopath" /><![CDATA[" width="]]><xsl:value-of select="$videowidth" /><![CDATA[" height="]]><xsl:value-of select="$videoheight" /><![CDATA[">
    <!--<![endif]-->
    <param name="quality" value="high" />
    <param name="wmode" value="transparent" />
    <param name="swfversion" value="6.0.65.0" />
    <param name="expressinstall" value="/scripts/expressInstall.swf" />
    <param name="loop" value="false" />
    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
    <div>
    <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
    <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
    </div>
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
    </object>

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

    </xsl:stylesheet>
  • bob baty-barr 1180 posts 1294 karma points MVP
    Oct 07, 2009 @ 16:21
    bob baty-barr
    0

    i am sure it is related to a < that needs to be escaped... most likely more than one...

  • Amir Khan 1287 posts 2744 karma points
    Oct 07, 2009 @ 16:44
    Amir Khan
    0

    Bob, thanks for your suggestion, I really have no idea how to implement it. Sorry, pretty new to this...

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Oct 07, 2009 @ 17:05
    Nik Wahlberg
    0

    Hi Amir,

    the biggest issue you had in this file were the (wrongly) nested CDATA tags. Instead of using the xsl:value-of tags to putput your values, you can use braces to ourput your vars if they live within your HTML attributes. Like so:

    {$varName}

    So, your file should look more like this:

    <?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="videonode" select="/macro/SettingsNode"/>
    <xsl:variable name="videopath" select="$videonode/node/data[@alias='Video']"/>
    <xsl:variable name="videoheight" select="$videonode/node/data[@alias='VideoHeight']"/>
    <xsl:variable name="videowidth" select="$videonode/node/data[@alias='VideoWidth']"/>

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

    <xsl:template match="/">

      <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{$videowidth}" height="{$videoheight}">
        <param name="movie" value="{$videopath}" />
        <param name="quality" value="high" />
        <param name="wmode" value="transparent" />
        <param name="swfversion" value="6.0.65.0" />
        <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
        <param name="expressinstall" value="/scripts/expressInstall.swf" />
        <param name="loop" value="false" />
        <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="{$videopath}" width="{$videowidth}" height="{$videoheight}">
          <!--<![endif]-->
          <param name="quality" value="high" />
          <param name="wmode" value="transparent" />
          <param name="swfversion" value="6.0.65.0" />
          <param name="expressinstall" value="/scripts/expressInstall.swf" />
          <param name="loop" value="false" />
          <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
          <div>
            <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
          </div>
          <!--[if !IE]>-->
        </object>
      <!--<![endif]-->
      </object>
             
    </xsl:template>

    </xsl:stylesheet>

    Still not sure about your nested OBJECT tags here and the browser conditionals, but as far as the XSL goes, this should work.

    HTH...

  • Amir Khan 1287 posts 2744 karma points
    Oct 07, 2009 @ 18:29
    Amir Khan
    0

    That XSLT makes perfect sense, thank you, I didn't realize I could treat variables that way.

    So, i've made a media picker alias "Video" text string alias "VideoHeight," etc. But those fields are still empty when i look at the resulting html, are those supposed to be macro paramaters?


    THank you for all your help and patience.

     

    -Amir

  • dandrayne 1138 posts 2262 karma points
    Oct 08, 2009 @ 00:40
    dandrayne
    0

    Hi Amir

    I believe in the original xslt I added in the previous page, it's actually using a custom media type with fields for width and height.   This means setting the width and height when the video is uploaded, and the same dimensions being used every time it is displayed.  I've since done the same using macro parameters, and I suppose there are arguments for and against both methods.

    Anyway, to use macro paramaters simply set videoHeight and videoWidth as macro parameters, and change the xslt to the following

    <xsl:variable name="videoheight" select="/macro/videoHeight"/>
    <xsl:variable name="videowidth" select="/macro/videoWidth"/>

    Also, the code above is for using a mediaCurrent macro parameter, which behaves slightly differently to the mediapicker page property, so if this is using a media picker you'd need to use a getMedia call to grab the url instead of the syntax above

    Dan

  • dandrayne 1138 posts 2262 karma points
    Oct 08, 2009 @ 00:45
    dandrayne
    0

    for completeness, something like the following may work (disclaimer: untested & I'm working late!)

    <xsl:variable name="videopath" select="umbraco.library:GetMedia($currentPage/data [@alias='Video'], 'false')/data [@alias = 'umbracoFile']"/>

    Dan

  • Wachter Bernd 48 posts 68 karma points
    Oct 15, 2009 @ 21:53
    Wachter Bernd
    0

    Hello

     

    I read all of this and Test It...

    It not work by me...

    Can anyone help me does this Script works ??

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 08:18
    Wachter Bernd
    0

    Hello,

    I have create a New Macro with the Code above and insert the Macro in my TextPage like this

    <asp:Content ContentPlaceHolderId="PlaceHolderFlash" runat="server">
    <umbraco:Macro Alias="InsertFlashBanner" runat="server"></umbraco:Macro></asp:Content>

    In my DocumentType Textpage i make a new Tab ("Flash Banner") and in him i insert a new Property
    with a MediaPicker..

    And then i have copy the swfobject.js in the Root/scripts Folder

    And when i start my Homepage and show in my Source Code the Code is insert but
    al the Variables are Emty ????
    The Path for the Flash File is also emty ?????

    <script type="text/javascript" src="/scripts/swfobject.js"></script><script type="text/javascript">
    // Previous JavaScript code
    var path = "";
    var videowidth = "";
    var videoheight = "";
    // 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>

    Can everyone Help me to make this functionaly ???

    Thanks Bernd

  • dandrayne 1138 posts 2262 karma points
    Oct 16, 2009 @ 12:26
    dandrayne
    0

    For anyone else who finds this thread ->  http://our.umbraco.org/projects/insert-flash-file

     

  • Dan Buhr 3 posts 23 karma points
    Jun 30, 2011 @ 15:43
    Dan Buhr
    0

    Any tips on wrapping the embedded object in a href (click on movie while playing results in redirect to page). I know it can be done by injecting code into the flash, and i currently have a working demo that works like a charm in all browsers, except IE v7+8+9. Let me know if this is LAS (lame and stupid).

Please Sign in or register to post replies

Write your reply to:

Draft