Hi,
Please view http://pdim.net/XMLTicker/ .
- I need help to set URL links to the specified URL on the individual URL items to open up a _blank browser window.
- The contents are generated through external XML file.
Here are the ActionScript below (Please keep in mind that there are 5 rows dynamic text fields each titled from “Zeile0 - Zeile 4”):
ON FRAME 1 :
// Init variables
// Maximum Number of Chars in one Line
var maxZeichen = 63;
// Number of Lines
var zeilenAnzahl = 5;
// Looping the whole Ticker-Text enabled (true/false)
//var loopText = false;
// ------
// tickerText which should show up at the start if there is no XML to be loaded and parsed
var lauftext = “”;
// Number of chars in tickertext
var lauftextLen = lauftext.length;
// Init counter
var counterZeichen = 0;
var aktZeile = 0;
// initialize array of rows
zeilen = new Array(zeilenAnzahl);
for (var i=0;i<zeilenAnzahl;i++) {
zeilen* = “”;
}
// Copy the rows in in the textfields
function copyTextField(num) {
set (“zeile” + num, zeilen[num]);
}
// add next char
function printNextChar() {
var wordChar = “”;
var wordCharLen = 0;
var umbruch = false;
// are there any chars left in tickertext?
if (counterZeichen < lauftextLen) {
// How long is the next word?
while ((counterZeichen+wordCharLen < lauftextLen) && (wordChar != " ")) {
wordCharLen++;
wordChar = lauftext.charAt(counterZeichen+wordCharLen);
if ((lauftext.charAt(counterZeichen+wordCharLen)+lauftext.charAt(counterZeichen+wordCharLen+1)) == “/n”) {
umbruch = true;
break;
}
}
// Does the word fit in the row (are there enough chars left)
if (!umbruch) {
if ((zeilen[aktZeile].length + wordCharLen) < maxZeichen) {
// get next char
thisChar = lauftext.charAt(counterZeichen);
// add next char
zeilen[aktZeile] += lauftext.charAt(counterZeichen);
// copy text in textfield
copyTextField(aktZeile);
// add to charcounter
counterZeichen ++;
}
else {
// Are there any rows left?
if (aktZeile + 1 < zeilenAnzahl) aktZeile++;
else {
// copy rows
for (var i = 0; i < zeilenAnzahl;i++) {
zeilen* = zeilen[i+1].valueOf();
copyTextField(i);
}
}
// add [Space]
counterZeichen++;
}
}
else {
// Zeilenumbruch
// Are there any rows left?
if (aktZeile + 1 < zeilenAnzahl) aktZeile++;
else {
// copy rows
for (var i = 0; i < zeilenAnzahl;i++) {
zeilen* = zeilen[i+1].valueOf();
copyTextField(i);
}
}
// add [Space]
counterZeichen+= 3;
}
}
else {
// Text is loaded, loop text?
//if (!loopText) stop();
//else counterZeichen = 0;
counterZeichen = 0;
}
}
// XML
// New XML object
urlText = new XML();
urlText.load(“text.xml”);
urlText.onLoad = onXmlText;
// Read text from XML-file
function onXmlText() {
mainTag = new XML;
mainTag = this.lastChild.previousSibling;
if(mainTag.nodeName.toLowerCase() == “tickertext”) {
lauftext = mainTag.firstChild.nodeValue;
lauftextLen = lauftext.length;
}
}
FRAME 2:
printNextChar();
FRAME 3:
gotoAndPlay(2);
Here is the XML file:
<?xml version=“1.0” encoding=“iso-8859-1”?>
<tickertext>-http://macromedia.com /n-[url=“http://adobe.com/”]http://adobe.com /n-[url=“http://apple.com/”]http://apple.com /n-[url=“http://microsoft.com/”]http://microsoft.com /n-[url=“http://amazon.com/”]http://amazon.com /n-[url=“http://google.com/”]http://google.com /n-[url=“http://gunstig.de/”]http://gunstig.de /n /n </tickertext>
Thanks for any help in this.