I’ve got this script, as it works now the text is loaded with XML.
It animates across screen, but not quite as i wish.
If you download the script: www.playart.dk/scroller.rar -> you will see the text removes itself before another text from the XML is loaded in the flash…
The way i would like it to work where it all comes in at the same line, so you can see 2 captions(nodes, text) at a time in one line…
Hope you understand my question…
If you dont want to download the file, the script looks like this:
//_root.p = 0;
//-----------------------
//Hent XML
function loadXML(loaded) {
//If XML is loaded
if (loaded) {
xmlNode = this.firstChild;
description = [];
_root.total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
trace(i);
description* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
trace(description*);
}
upDatePic();
} else {
content = “file not loaded!”;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
//xmlData.load("/site/utils/scroller.asp?doc_id="+doc_id);
xmlData.load(“images.xml”);
//Opdaterer billede (Updates the whole ting to a new caption)
function upDatePic (){
filesize = description.getBytesTotal();
loaded = description.getBytesLoaded();
if (loaded == filesize) {
DynamicTXT.desc_txt = description[p];
PlayTextMC(total); // Play this for every new caption }
}
function PlayTextMC(total){
for (i=0; i<total; i++) {
//trace(total)
_root.DynamicTXT._x = 500;
}
}
At the textMC the AS is:
onClipEvent(enterFrame) {
speed = -2.6;
this._x += speed;
}
I’ve also got a mc called timer which is placed at the AS layer.
In timerMC, there is some AS:
if (_root.p<(_root.total-1)) {
_root.p = _root.p += 1;
//trace(_root.p);
} else {
// If p is bigger than the total, set it to 0.
_root.p = 0;
}
_root.upDatePic(total);