在as 3.0中与php集成时,我的代码中出现了一些错误

在as 3.0中与php集成时,我的代码中出现了一些错误,php,actionscript-3,flash,Php,Actionscript 3,Flash,我试图通过php增强db连接。为此,我在mysql中创建了表,并创建了相应的php。它在Xamp中工作。然后我尝试创建flash文件,即从数据库中获取数据到列表中。这是我的as文件 var theXML:XML = new XML(); theXML.ignoreWhite=true; theXML.onLoad=function(){ var i; var nodes=this.firstChild.childNodes; for(i=0;i<nodes.leng

我试图通过php增强db连接。为此,我在mysql中创建了表,并创建了相应的php。它在Xamp中工作。然后我尝试创建flash文件,即从数据库中获取数据到列表中。这是我的as文件

var theXML:XML = new XML();
theXML.ignoreWhite=true;
theXML.onLoad=function(){
    var i;
    var nodes=this.firstChild.childNodes;
    for(i=0;i<nodes.length;i++){

// Error        **theList.addItem(nodes[i].firstChild.nodeValue,i);**
    }
}
theXML.load("http://localhost/praven/product.php");
var theXML:XML=newxml();
theXML.ignoreWhite=true;
theXML.onLoad=function(){
var i;
var nodes=this.firstChild.childNodes;
对于(i=0;i试试这个:

    var theXML:XML = new XML();
    theXML.ignoreWhite=true;
    theXML.onLoad=function(success){
      if(success){
        var i;
        var nodes=this.firstChild.childNodes;
        for(i=0;i<nodes.length;i++){

            theList.addItem({label:nodes[i].firstChild.nodeValue,data:i});
        }
    }
    else{
    trace("Error");
    }

}
theXML.load("http://localhost/praven/product.php");
var theXML:XML=newxml();
theXML.ignoreWhite=true;
theXML.onLoad=函数(成功){
如果(成功){
var i;
var nodes=this.firstChild.childNodes;

对于(i=0;ithis.firstChild.childNodes;与XMLDocument一起工作,您正在使用XML。如果您想使用XMLNodes,只需将您的XML转换为XMLDocument。

谢谢mgraph,但仍然存在一些问题。现在它显示的类型错误:Error#1006:value不是函数。在列表中_fla::MainTimeline/frame1()当我运行fla文件时,它会在输出窗口中显示此错误…TypeError:error#1006:value不是函数.它没有显示哪一行的错误。因为我是flash的新手。我无法纠正it@PraveenBabu等等,您是在使用as2还是as3,因为此脚本是针对as2而不是as3ohh的感谢mgraph我在as3.ty中使用此脚本以获取信息。我将在as2中尝试此代码。:)你知道这是actionscript 2吗?没有必要转换成xmldoc,因为PHP-->view pagesource的输出是xml格式的。我在这里没有提到PHP代码。但我转换成xml格式。无论如何,我在mgraph的帮助下获得了输出。实际上我在as3中尝试了tat代码。tat是问题所在,我纠正了它并获得了输出。谢谢你的帮助我