Copied to clipboard

Flag this post as spam?

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


  • D-au 26 posts 76 karma points
    Nov 02, 2011 @ 07:08
    D-au
    0

    Import Members attributes to Flash

    Hi there,

    Is it possible for umbraco attributes to have its way through flash. I know that using xml is one of the most convenient way to control flash from umbraco, but I just could not find any articles that manage to explain thoroughly on how to display umbraco attributes by (maybe) passing it to xml and then to flash (actionscript).

    On my case, I wanted to create a (true/false) custom attribute on member types, then having flash/ actionscript check wether the current user attribute was true/ false, hence enabling/ disabling one of the function in the flash movie/ actionscript.

    Any thoughts?

     

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Nov 02, 2011 @ 08:31
    Markus Johansson
    0

    Hi!

    I guess there is to main approches.

    1. Using flashvars to import data using "querystrings"

    Tutorial: http://circlecube.com/2008/05/flashvar-tutorial/

    Just create your flash-file and insert the data using the flashvars, grab them from umbraco using proptery-fields in a template or use a macro.

    2. By reading a xml-file from flash

    Create a macro that renders the xml as needed and insert that macro in a custom template.

  • D-au 26 posts 76 karma points
    Nov 03, 2011 @ 23:30
    D-au
    0

    I might go with option no 2 in this case, cos my flash file is currently running on hardcoded xml anyway. Mind showing me an example of a macro that renders the xml

    I use xslt all the time, but just could not reconfigure how to make it render .xml. Or even where to find the location of .xml output resulted from the xslt.

     Thanks

    Audee

  • D-au 26 posts 76 karma points
    Nov 04, 2011 @ 04:03
    D-au
    0

    Hi All,

    Nevermind, I've found the solution to it.

    1. Literally create the xml file format on xslt/macro. (just recently notice that you could put tags without getting an error)

    e.g. hardcoded xml

    <!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="no" indent="yes"/> <xsl:param name="currentPage"/> <xsl:template match="/"> <MODE> <module> <titled>1. Introduction</titled> <descriptionm> Your introduction</descriptionm> <videoname>h264best.flv</videoname> <videoiframe>/module1.aspx</videoiframe> </module> </MODE> </xsl:template> </xsl:stylesheet>

     

    2. put this macro into one of the templates (e.g. I named mine "templatexml"), and just this macro inside it.

    3. On your flash file/ actionscript, change the xml source file from "my_old_xml_file.xml" to "?altTemplate=templatexml" 

    That did the trick for me

    Thanks

    Audee

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Nov 04, 2011 @ 06:22
    Markus Johansson
    0

    Sorry for taking so long! (Swedish timezone) =)

    Your solution is exactly as I was thinking. You could add these two lines inside the "xsl:template"-tag to change the mime-type and declare the xml-version

     

    <xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
    <rss version="2.0">

Please Sign in or register to post replies

Write your reply to:

Draft