We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31283
    • 22 Posts
    Hi there, I figure there are numerous ways to do this, but perhaps someone has already written the code or made a plugin.

    Here’s the breakdown:

    Current:


    • Flash movie on page loads XML.
    • XML contains multiple images paths for a gallery.

    Would like to:


    • Allow client to add / delete images.
    • AVOID having client manipulate XML tags in any way.

    So ideally, the client could add images to the resource through either tv’s or by directly embedding images. Then I could parse the resource for each image path and write the xml.

    Is there an easier way to do this?

    Thank you.
      • 31283
      • 22 Posts
      The idea here was to parse a resource’s img tags, passing their src attributes as xml to a Flash movie through the swfobject script. This way the client can just add images to a page itself, which would automatically be hidden on the page but used in the movie. The problem was that passing a string with line breaks through flashvars brings it all to a grinding halt.

      A solution:

      <script type="text/javascript">
                  function call_xml()
                     {
                          var xmlString    = new String();
                          xmlString        = {{xmlPath-main}}.toString();
                          xmlPortfolio     = (xmlString.replace(/\n/g,""));
                     }
                  call_xml();
                  var flashvars = {};
                      flashvars._xml      =  xmlPortfolio;
                  var params = {};
                  var attributes = {};
      
                  swfobject.embedSWF("assets/flash/portfolio.swf", "swf-portfolio", "870", "610", "10.0.0", "#ffffff", flashvars, params, attributes);
      </script>


      Inside of the {{xmlPath-main}} chunk:

      <xml_data><portfolio>[[Ditto? &parents=`6` &tpl=`tpl_XML` &sortBy=`menuindex` ]]</portfolio></xml_data>


      (The container resource for all of the portfolio pages has an id# of 6.)

      Inside of the {{tpl_XML}} chunk:

      <imagePath>[+content+]</imagePath>


      Then the swf just parses all this junx, looking for the img nodes and grabbing the src attributes to load images. And for better or for worse, the client now has control over the Flash movie.

      Hope this helps someone (or myself, when I forget how this works).