Copied to clipboard

Flag this post as spam?

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


  • Uros Sankovic 107 posts 134 karma points
    Jun 18, 2010 @ 15:42
    Uros Sankovic
    0

    How to work with Flash?

    Hi,

    as I understand, Umbraco saves all data in XML. If so, is it possible to prepare a DocumentType for Flash movie? Flash movie reads the XML, which gets data through DocumentType. Any ideas?

    THX for any help.

    Uros

  • dandrayne 1138 posts 2262 karma points
    Jun 18, 2010 @ 15:51
    dandrayne
    0

    Hi Uros

    Absolutely it is.  You can use xslt macros to create an xml feed suitable for flash.  Lots of sites do this, an example one we did at www.davidoni.com

    It would probably not be recommended to read the umbraco xml file directly.  By transforming it with xslt you are able to produce exactly the xml you want.

    Dan

  • dandrayne 1138 posts 2262 karma points
    Jun 18, 2010 @ 15:51
    dandrayne
    0

    oops, that was www.davidboni.com

  • Uros Sankovic 107 posts 134 karma points
    Jun 18, 2010 @ 15:53
    Uros Sankovic
    0

    Dan, thx for your reply. Can you give me please more directions?I'm pretty new to XSLT. And how did you tell the Flash where to get the data?

    THX again.

  • Rich Green 2246 posts 4006 karma points
    Jun 18, 2010 @ 15:57
    Rich Green
    0

    If you have Umbraco TV then look here

    http://umbraco.org/documentation/videos/for-developers

    Under "Rich Internet Applications"

    Rich

  • Uros Sankovic 107 posts 134 karma points
    Jun 18, 2010 @ 16:06
    Uros Sankovic
    0

    Rich, I don't have Umbraco TV

  • dandrayne 1138 posts 2262 karma points
    Jun 18, 2010 @ 16:15
    dandrayne
    0

    Hi Uros

    For xslt you can find some great resources in the umbraco Wiki and docs section (see http://umbraco.org/documentation/books/xslt-basics/ for a start).

    Once you've got a handle on that, here's how I output xml.

    1)  Create an xslt macro that gets site data and creates xml.  below is a very simple example

    <?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">
    <sitedata>
    <galleries>
    <xsl:for-each select="$currentPage/node [@nodeTypeAlias='Gallery']">
    <gallery>
    <name><xsl:value-of select="@nodeName" /></name>
    </gallery>
    </xsl:for-each>
    </galleries>
    </sitedata>

    </xsl:template>

    This creates output like the following

    <sitedata>
    <galleries>
    <gallery>
    <name>Gallery one</name>
    </gallery>
    <gallery>
    <name>Gallery two</name>
    </gallery>
    </galleries>
    </sitedata>

    Which can be used in your flash as xml.  To do that,

    2) create a template to hold your new xslt macro, such as

    <%@ Master Language="C#" MasterPageFile="/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <?xml version="1.0" encoding="UTF-8"?>
    <umbraco:Macro Alias="yourMacroName" runat="server"></umbraco:Macro>
    </asp:Content>

    This sticks the xml declaration.  Now the simplest thing to get your template working is.... say your homepage is at /home.aspx - you can use this template on it at

    /home/templateName.aspx 

    or

    home.aspx?altTemplate=templateName

    3) and to pass that to flash I just use flashvars.  For that see http://kb2.adobe.com/cps/164/tn_16417.html or (my recommended way) use swfobject and pass the flashvars in via javascript (http://code.google.com/p/swfobject/wiki/documentation).  Your swf file could allow a flashvar for "xml location" or if you want you could even hardcode it in the swf.

    Hope this helps,
    Dan

  • Uros Sankovic 107 posts 134 karma points
    Jun 18, 2010 @ 16:55
    Uros Sankovic
    0

    Thank you very much!

    Uros

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies