2 Replies Latest reply on Jul 21, 2008 10:15 AM by pranay.kuru

    Help with ynamic variable evaluation

    pranay.kuru
      Hi guys,

      If someone can point me out to how to evaluate variables as part of an expression.

      for ex:

      event.result.reporting.series[0].eval("y"+j+"Label");

      basically how do i write the equivalent of eval in flex/actionscript

      Thanks a ton,

      Pranay
        • 1. Re: Help with ynamic variable evaluation
          Gregory Lafrance Level 6
          It might be this:

          event.result.reporting.series[0]["y"+j+"Label"];
          • 2. Re: Help with ynamic variable evaluation
            pranay.kuru Level 1
            Thanks Greg, saved my day................
            1 more question


            Problem:
            My flex httpservice returns an xml file in the "object" resultFormat.
            How could I get the count of all childNodes of an object in that returned object tree.

            For example, in the xml file below:

            <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
            <reporting>
            <series>
            <title>Edge Page Views, in Page Views per Second</title>
            <xLabel>startdatetime</xLabel> <y1Label>sum(pageviews)</y1Label>
            <data>
            <x>1216233600</x>
            <y1>79.605</y1>
            </data>
            <data>
            <x>1216233900</x>
            <y1>78.076</y1>
            </data>
            </series>
            <series>
            <title>Total Bandwidth, in Mbits per Second</title>
            <xLabel>startdatetime</xLabel>
            <y1Label>sum(egress_bytes_mbps)</y1Label>
            <y2Label>combined_midgress_bytes_mbps</y2Label>
            <y3Label>ovh_bytes_mbps</y3Label>
            <y4Label>sum(ingress_bytes_mbps)</y4Label>
            <data>
            <x>1216233600</x>
            <y1>36.160352</y1>
            <y2>66.48362700000001</y2>
            <y3>66.48362700000001</y3>
            <y4>96.01235200000002</y4>
            </data>
            <data>
            <x>1216233900</x>
            <y1>34.260794</y1>
            <y2>62.10649799999999</y2>
            <y3>62.10649799999999</y3>
            <y4>88.902323</y4>
            </data>
            <data>
            <x>1216234200</x>
            <y1>35.329617</y1>
            <y2>62.77339099999999</y2>
            <y3>62.77339099999999</y3>
            <y4>89.30751</y4>
            </data>
            </series>
            </reporting>


            The first series element has 4 children
            I am able to get the number of data elements as: "resultObj.reporting.series[0].data.length"
            How do I effectively retreive: "resultObj.reporting.series[0].childNodes().length"
            Apparently this does'nt work, I also tried Nodes, children().

            Any documentation or help with this would be awesome

            Thanks a ton

            Pranay