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