A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: The Buffer Problem

  1. #1
    Junior Member
    Join Date
    Nov 2000
    Posts
    6
    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

  2. #2
    Senior Moderator ®
    FK´s Banning Machine ™
    GMF ™'s Avatar
    Join Date
    Feb 2000
    Location
    Oslo, Norway
    Posts
    5,697
    Moved to Scripting and Backend

  3. #3
    Junior Member
    Join Date
    Sep 2000
    Location
    istanbul
    Posts
    24

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center