open flash chart 实时数据显示问题,高手来看啊

我想用Open flash chart 做一个图形实时显示,可以总有点问题,代码如下:
1.载入js
<script type="text/javascript" src="../inc/ofc/js/swfobject.js"></script>
    <script type="text/javascript" src="../inc/ofc/js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../inc/ofc/js/json/json2.js"></script>
2.声明:<div id="my_chart"></div>
3.调用:
  var data ={};
            var flashvars = {};
            var params = {scale:"noorder"};
            var attributes = {wmode:"Transparent"};  //window, Opaque, Transparent 三种模式
            var so= new swfobject.embedSWF("../inc/ofc/open-flash-chart.swf", "my_chart", "300", "220","9.0.0",flashvars,params,attributes);

4.相应的函数
function ofc_ready()
          {
              alert('ofc_ready');
              tmp = findSWF("my_chart");
               x = tmp.load( JSON.stringify(my_chart));
          }
          function open_flash_chart_data()
          {
              alert( 'reading data' );
              return JSON.stringify(data);
          }
          function findSWF(movieName)
          {
              if (navigator.appName.indexOf("Microsoft")!= -1) //判断是否为IE浏览器
              {
                    return window[movieName];
                }
                else
                {
                    return document[movieName];
                }

          }
5.用AJAX调用aspx的内容

var showXMLHTTP  = new ActiveXObject("Microsoft.XMLHTTP");
function getXMLHTTPObj()
                {
                    var url = "bar.aspx";
                    showXMLHTTP.open("GET", url, true);
                    showXMLHTTP.setRequestHeader("If-Modified-Since","0");
                    showXMLHTTP.onreadystatechange = updatePage;
                    showXMLHTTP.send(null);
                }
            function updatePage()
                {
                    if (showXMLHTTP.readyState == 4)
                {
                if (showXMLHTTP.status == 200)
                {
                try
                {
                    //alert(showXMLHTTP.responseText);
                    var httpText = showXMLHTTP.responseText;
                    data=eval('('+httpText+')');
                    tmp = findSWF("my_chart");
                    x = tmp.reload();
                }
                catch(e)
                {alert("W");
                }
                 }
                 else if (showXMLHTTP.status == 404)
                 {
                //alert("showmapXMLHTTP URL does not exist");
                 }
                 else
                 {
                //alert("Error: status code is " + showmapXMLHTTP.status);
                 }
                }
                }

6 问题:

   为什么调用   x = tmp.reload();函数,总是异常,原来tep是空,没有找到tmp = findSWF("my_chart");返回的是空值。

7 有什么好的办法么?

你可能感兴趣的:(json,Ajax,Microsoft,IE,Flash)