Copied to clipboard

Flag this post as spam?

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


  • Wachter Bernd 48 posts 68 karma points
    Oct 15, 2009 @ 19:22
    Wachter Bernd
    0

    Insert Flash File

    Hello,

    In my Homepage i have in Top a Div Tag to hold a Flash File swf...

    OK i will make this

    In my Page i will make a Tab like "Flash Header"
    In this Tab i have a Media Pickup where i can select the Flash File from my Media Galerie

    And when i insert a Flash File with the Media Picker and Save then must the Flash File insert in my
    Div Container where i have make at the top of the Page.. and shows...

    Can i make this in Umbraco so ????

    Also my Customer goes to a Page and goes to a Tab Flash Header and select a Flash File from the Media Galerie
    and save this....
    Then the Flash File is show correct on my Homepage ... in my DIV Tag ???

  • Kim Andersen 1447 posts 2197 karma points MVP
    Oct 16, 2009 @ 00:10
    Kim Andersen
    0

    You can make this with XSLT.

    First of all you make your XSLT-macro and includes it in the template you want the flash to be vissible in.

     

    Then in the XSLT you can write this:

    <xsl:variable name="flashUrl" select="umbraco.library:GetMedia($currentPage/data [@alias = 'mainFlash'], 'false')/data [@alias = 'umbracoFile']"/>
       <div id="flashContainer">
           <object type="application/x-shockwave-flash" data="{$flashUrl}" width="600px" height="250px">
               <param name="movie" value="{$flashUrl}" />
               <param name="wmode" value="transparent" />
               <embed src="{$flashUrl}" width="600" height="250" type="application/x-shockwave-flash"></embed>
           </object>
    </div>

    This is one way to do it. In this example you will write out your div-tag in the XSLT also.

    And remember to adjust the width and height, so it matches the sizes that you use in your site. Also remember to change the alias to whatever your flash-field is called.

     

    If you have any more questions to the above code, don't hesitate to ask again :)

     

    /Kim Andersen

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

    Hi Kim,

    I have found this Topic

    http://our.umbraco.org/forum/using/ui-questions/2913-Inserting-flash-by-end-users

    I have test it.. but its not work... i very new with umbraco :-)

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Oct 16, 2009 @ 09:05
    Rasmus Berntsen
    0

    Did you remember the swfObject.js?? :)

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 10:01
    Wachter Bernd
    0

    Yes i have copy the swfobject.js in my Root/scripts Folder

    I have download the newest Version of swfscript ..

    Is this a Problem ? must i use a older Version ?

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 10:05
    Wachter Bernd
    0

    I have copy the swfobject Version 2.2 under Root/Scripts

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 10:15
    Wachter Bernd
    0

    OK here my Thing

    I have a Homepage with a Flash Placeholder on the Top of the Page
    Must i have a separate Placeholder or is correct when i only have a Div Tag in my Masterpage for
    hold my Flash Banner ???

    All my Flash Banners on top always have the same Width and Height ....
    On each of my Page i must Load a other Flash Banner (.swf File)

    I have my Banners make with a Tool hes generate the swf File and each swf File have
    a XML File in Background with the Path of the Images wehere Load in this SWF..

    OK i will on each Page a Toolbar Button, and when i click on this
    then can i Insert the Flash File from my Media Galery with a Media Picker...
    and then the Flash must play on this Page at the Top in my Flash DIV Tag..

     

  • dandrayne 1138 posts 2262 karma points
    Oct 16, 2009 @ 10:25
    dandrayne
    0

    Hi there

    If you're using the solution from http://our.umbraco.org/forum/using/ui-questions/2913-Inserting-flash-by-end-users?p=0#comment9539 then it uses swfobject 1.5 and the latest version won't work without a little bit of tweaking.

    Hope this helps,
    Dan

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 10:44
    Wachter Bernd
    0

    Hi Dandyrayne,

    Is this a Problem when i use Version 1.5 ?

    It is not better when i use the newest Version ???

  • dandrayne 1138 posts 2262 karma points
    Oct 16, 2009 @ 10:47
    dandrayne
    0

    Yeh maybe, but at the end of the day all it does is insert a flash file on a page and 1.5 seems to do that without any problem.

    I should update that code to use the new version though

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 10:52
    Wachter Bernd
    0

    Thanks,

    Ok then i wait of the new Code for the Version 2.2

    Thanks

     

    I have test at this time with Version 1.5.1

    When i show in my Source Code the Path to my SWF File is alway emty

    I become alway this in my Source ?

    <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>

    I have make a new Tab in my Document Type and Insert a MediaPicker ?

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

    Howdy

    I've packaged an updated version of that script, which now uses standard media type and the new version of swfobject.  You should find that much easier to install and use.

    http://our.umbraco.org/projects/insert-flash-file

    Dan

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 13:21
    Wachter Bernd
    0

    Hi Dandrayne,

    Ok i have Installed your File...

    I have insert the Macro in my Masterpage Flash Content Placeholder
    and set the Parameters Widt and Height and set the Video ID to the Name of my DIV Tag
    "flashLayer" where i will insert the Flash File ??

    Then i go to Settings /Document Types and make a new Tab in my Textpage.
    In this insert a new Property:
    Name: Flash BAnner
    Alias: FlashBanner
    Type: Media Picker
    Tab: Flash Banner

    Then i go to a Page and go to the Tab Flash Banner an select a Flash File with the Media Picker
    and save this..

    Then i start my Page and show in the Source Code
    The var path = ""; is Emty ????

    Is this the correct Way ???
    My Code becomes not the File Name of my Flash File where i set in the Media Picker

     

    What am I doing wrong

     

     

  • dandrayne 1138 posts 2262 karma points
    Oct 16, 2009 @ 15:02
    dandrayne
    0

    ooh, let's see.

    • The .swf file should be uploaded to the media library, as a standard "file" media type.
    • Install the package
    • Within the editor on any page use the "insert macro" button and select "insert flash file"
    • Use the picker to select the flash file from the media library, add an ID and width and height
    • Save and publish

    And that's it.  You don't need to add any new fields to a document type using this macro

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 15:07
    Wachter Bernd
    0

    Hi,

    Ok but i have only one Editor Field for my Content !!

    my Flash Banner is in a separate Content Place Holder ...

    I will the flash File not show in my Content Section, i will the Flash File show in a DIV Tag "flashLayer"
    at the top of my Page
    My Content is separtate ...

  • dandrayne 1138 posts 2262 karma points
    Oct 16, 2009 @ 15:31
    dandrayne
    0

    Ahh ok, the package won't work for you then.

    You could use the same xslt as a starting point, and depending on how you're setting the flash file the variables will change

    <?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="$currentPage/data[@alias='YourMediaPickerPage']"/>
    <xsl:variable name="videoid" select="flashLayer"/>
    <xsl:if test="string($videonode) != ''">
    <xsl:variable name="videopath" select="umbraco.library:GetMedia($videonode, 'false')/data[@alias='umbracoFile']"/>
    </xsl:if>
    <xsl:variable name="videoheight" select="300"/>
    <xsl:variable name="videowidth" select="500"/>



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

    <xsl:template match="/">

    <div>
    <xsl:attribute name="id">
    <xsl:value-of select="$videoid" />
    </xsl:attribute>
    <p><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this content.</p>
    </div>
    <script type="text/javascript" src="/scripts/swfobject.js"></script>
    <script type="text/javascript">
    <![CDATA[

    var path = "]]><xsl:value-of select="$videopath" /><![CDATA[";
    var videowidth = "]]><xsl:value-of select="$videowidth" /><![CDATA[";
    var videoid = "]]><xsl:value-of select="$videoid" /><![CDATA[";
    var videoheight = "]]><xsl:value-of select="$videoheight" /><![CDATA[";
    var flashvars = {};
    var attributes = {};
    var params = {
    wmode: "transparent",
    allowfullscreen: "true",
    allscriptaccess: "always"
    };

    swfobject.embedSWF(path, videoid, videowidth, videoheight, "9.0.0", flashvars, params, attributes);

    ]]>
    </script>


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

    </xsl:stylesheet>

    Dan

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 15:42
    Wachter Bernd
    0

    I have now insert your xslt Code above in my InsertFlashFile.xslt

    I become now a Error by saving the File

     

    Error occured

    System.Xml.Xsl.XslLoadException: 'xsl:if' kann kein untergeordnetes Element des 'xsl:stylesheet'-Elements sein. Fehler bei D:\InetPub\wwwroot\www.almrausch.at\Umbraco\xslt\633913042719540000_temp.xslt(16,1).
    bei System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
    bei System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
    bei umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

    I think its better when i give you a account from my Demo Site
    to show the Problem... I a very Newbie with Umbraco :-)

    What you think?



  • dandrayne 1138 posts 2262 karma points
    Oct 16, 2009 @ 15:47
    dandrayne
    0

    Err ok, if it gets your issue sorted!

    Mail me at

    dan [at] geckonm [dot] com

  • Jacob Jensen 29 posts 49 karma points
    Oct 16, 2009 @ 15:59
    Jacob Jensen
    0

    xsl:if cannot be a child of xsl:stylesheet, it has to be in a template.

  • Wachter Bernd 48 posts 68 karma points
    Oct 16, 2009 @ 15:59
    Wachter Bernd
    0

    OK i have send you an Email with the Data

    Thanks

  • Jacob Jensen 29 posts 49 karma points
    Oct 16, 2009 @ 15:59
    Jacob Jensen
    0

    or inside the variable

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

    Very true, I should really test before posting!  But where's the learning value in that eh ;-)

    For reference, here's working xslt for a flash file chosen via a mediapicker on the page on which it is to be displayed. (also using hardcoded height etc for speed)

    <?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:template match="/">


    <xsl:if test="string($currentPage/data[@alias='VideoID']) != ''">
    <xsl:variable name="videonode" select="$currentPage/data[@alias='VideoID']"/>
    <xsl:variable name="videopath" select="umbraco.library:GetMedia($videonode, 'false')/data[@alias='umbracoFile']"/>
    <xsl:variable name="videoheight" select="300"/>
    <xsl:variable name="videowidth" select="500"/>




    <div id="flashLayer">
    <p><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this content.</p>
    </div>
    <script type="text/javascript" src="/scripts/swfobject.js"></script>
    <script type="text/javascript">
    <![CDATA[

    var path = "]]><xsl:value-of select="$videopath" /><![CDATA[";
    var videowidth = "]]><xsl:value-of select="$videowidth" /><![CDATA[";
    var videoheight = "]]><xsl:value-of select="$videoheight" /><![CDATA[";
    var flashvars = {};
    var attributes = {};
    var params = {
    wmode: "transparent",
    allowfullscreen: "true",
    allscriptaccess: "always"
    };

    swfobject.embedSWF(path,"flashLayer", videowidth, videoheight, "9.0.0", flashvars, params, attributes);

    ]]>
    </script>

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

    </xsl:stylesheet>

     

  • Wachter Bernd 48 posts 68 karma points
    Oct 17, 2009 @ 10:57
    Wachter Bernd
    0

    Hi,

    It works perfect !! Thanks

     

    Can i with my Technik you have insert make the following ?

    In my Tab "Flash Banner" where i set the Flashfile with the MediaPicker
    ad a Textfield wher i can set a Parameter for my Flash File ???

    This is so: I must send a Flash Parameter to my Flashfile when Load this
    Like so: AlbumID="1"

    My FlashFile wait for a Variable to Load the right Album


    Thanks

  • dandrayne 1138 posts 2262 karma points
    Oct 19, 2009 @ 10:37
    dandrayne
    0

    Hi Wachter

    You need to look at the "flashvars" part of swfobject, your vars will probably go here

    var flashvars = {};
Please Sign in or register to post replies

Write your reply to:

Draft