Hello - timdiekman
here is the xml I use (it’s a template) So it is filled with the values from the page.
<?xml version="1.0" encoding="utf-8"?>
<document>
<title name="title" content_type="titletext"> [*pagetitle*]</title>
<title name="longtitle" content_type="titletext">[*longtitle*]</title>
<content name="content" content_type="bodytext">[*content*]</content>
<image name="homeimage" content_type="image">[*workhomepageimage_var*]</image>
<image name="mainimage" content_type="image">[*workmainimage_var*]</image>
<image name="thumbnailimage_on" content_type="image">[*workthumbimage_on_var*]</image>
<image name="thumbnailimage_off" content_type="image">[*workthumbimage_off_var*]</image>
</document>
here is an AS2 function that I use to load in the above content.
function xmlLoader_Func(xml,ini,id,mc){
/*
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.ini = ini;
my_xml.onLoad = function(success){
var work_string : String = '';
if (success){
var pagecontent = this.firstChild.childNodes;
if(ini != true){
_root[mc].createEmptyMovieClip('work_' + id, id); // on each xml document loaded a mc for the work is created using 'work_' + id .
}
for(i = 0; i<pagecontent.length;i++){ // this cycles through the childNodes of the XML
if(ini == true){ // this if statement will return the string value for the values of the work documents.
work_string = pagecontent[i].firstChild.nodeValue;
_root.seperateContent_Func(work_string);
}else{
switch (pagecontent[i].attributes.name){ // this checks to see the name of the attribute of the child node, and then sets up a var for each item on the desired work mc
case 'title':
_root[mc]['work_' + id].pagetitle = pagecontent[i].firstChild.nodeValue;
break;
case 'longtitle':
_root[mc]['work_' + id].longtitle = pagecontent[i].firstChild.nodeValue;
break;
case 'content':
_root[mc]['work_' + id].content_text = pagecontent[i].firstChild.nodeValue;
break;
case 'homeimage':
_root[mc]['work_' + id].homeimage = pagecontent[i].firstChild.nodeValue;
break;
case 'mainimage':
_root[mc]['work_' + id].mainimage = pagecontent[i].firstChild.nodeValue;
break;
case 'thumbnailimage_on':
_root[mc]['work_' + id].thumbnailimage_on = pagecontent[i].firstChild.nodeValue;
break;
case 'thumbnailimage_off':
_root[mc]['work_' + id].thumbnailimage_off = pagecontent[i].firstChild.nodeValue;
trace('!!-------!!');
break;
}//end of switch statement
} //end of if / else statement
} //end of for loop
if(ini != true){
_root.generateThumbs_Func(mc,'work_',id);
_root.generateMainContent_Func(mc,'work_','content_mc',id);
}
} //end of of(success)
} //end of my_xml.onLoad
my_xml.load(xml);
}
and here is a code snippet from a the function
generateMainContent_Func :: this part of the function loads an image.
var loadListener:Object = new Object();
loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
trace(">> loadListener.onLoadComplete()");
trace(">> =============================");
trace(">> target_mc.: " + target_mc._target); // 0
_root.loadtotal++;
}
loadListener.onLoadInit = function(target_mc:MovieClip):Void {
trace(">> loadListener.onLoadInit()");
trace(">> =============================");
trace(">> target_mc.: " + target_mc._target); // 315
}
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
mcLoader.loadClip(url + _root[parent_mc][work_mc + id].mainimage, _root[parent_mc][content_mc]['work_' + position]['image']);
as you can see above I am using loadClip to load the mainimage variable from the xml onto an mc called _root[parent_mc][content_mc][’work_’ + position][’image’] - the reason why I am loading it this way is that there are 15 different "sections" to be loaded (so that means 15 different pages from modx) all to be loaded into one xml container, when the site goes live i’ll send a link - but it isn’t quite there yet.
hope that helps? if not let me know and I’ll try and explain how it works a bit better. This is all done in AS2 as i needed to make sure that I could compile the site to flash 8.