-
Hi All,
I have a serious flash-problem.
- I have written a flashmovie which receives a cgi stream of xml data:
<--- part of the cgi stream --->
<?xml?>
<logs>
<line>
<time>value_a</time>
<action>value_b</action>
<intf>value_c</intf>
<proto>value_d</proto>
<source>value_e</source>
<destination>value_f</destination>
<service>value_g</service>
<src>value_h</src>
<rule>value_i</rule>
<length1>value_j</length1>
</line>
.
.
.
and so on...
- My ActionScript which handles the data stream input looks like this:
function loadLogs () {
this.load("https://somewhat.com/viewer.xml");
}
function pullLogs ()
{
mainTag = new XML();
Tag = new XML();
itemTag = new XML();
lineList = new Array();
itemList = new Array();
_root.lastRefresh = getTimer();
mainTag = this.firstChild;
if (mainTag.nodeName.toLowerCase() == "logs") {
lineList = mainTag.childNodes;
for (i=0; i<=lineList.length; ++i) {
if (lineList[i].nodeName.toLowerCase() == "line") {
lineTag = lineList[i];
itemList = lineTag.childNodes;
for (j=0; j<itemList.length; ++j) {
itemTag = itemList[j];
itemType = itemTag.nodeName.toLowerCase();
if (itemType == "time") {
time += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "action") {
action += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "intf") {
intf += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "proto") {
proto += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "source") {
source += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "destination") {
destination += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "service") {
service += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "src") {
src += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "rule") {
rule += ""+itemTag.firstChild.nodeValue+"<br>";
} else {
if (itemType == "length1") {
length1 += ""+itemTag.firstChild.nodeValue+"<br>";
}
}
}
}
}
}
}
}
}
}
}//2. for
}//2. if
}//1. for
}//1. if
}//function
lastRefresh = 0;
refresh = 30;
logData = new XML();
logData.onLoad = pullLogs;
logData.loadLogs = loadLogs;
logData.loadLogs();
- I have tried to put each -nodeValue- into an movie array and tried delete the last visible movie, but the movie slowed down and crashed everytime.
I would be very thankful for every hint (or solution?!), thanks.
>muck
-
Moved to Scripting and Backend
-
hi
did you try to give node names as numbers and make a loop that hmm....
i mean something like this..
stream
-------
<--- part of the cgi stream --->
<?xml?>
<logs>
<line>
<1>value_a</1>
<2>value_b</2>
<3>value_c</3>
...
code
-----
...
for (n=1;n>10;n++){
if (Number(itemType) == n) {
set Variable "myvar" & n += ""+itemTag.firstChild.nodeValue+"<br>";
...
or something like this..
maybe not answer to your question but it makes your code smaller.. and maybe faster.. maybe not..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|