2012-02-28 134 views
-6

的错误&源的访问:AS3 - 编译器错误1120:未定义的属性* 7

1120: Access of undefined property projectsNum. 
projectsNum = projectTitle.length(); 

1120: Access of undefined property newsTitleArray. 
newsTitleArray = xmlData.news.article.title.text().toXMLString().split("\n") ; 

1120: Access of undefined property newsTitleArray. 
newsTitleArray.reverse(); 

1120: Access of undefined property newsInfoArray. 
newsInfoArray = xmlData.news.article.info.text().toXMLString().split("\n") ; 

1120: Access of undefined property newsInfoArray. 
newsInfoArray.reverse(); 

1120: Access of undefined property newsContentArray. 
newsContentArray = xmlData.news.article.Content.text().toXMLString().split("\n") ; 

1120: Access of undefined property newsContentArray. 
newsContentArray.reverse(); 

我的XML行动的行动,我怀疑的错误是:

//XML LISTS// 
//=========// 

var projectTitle:XMLList; 
var projectAuthor:XMLList; 
var projectImage:XMLList; 
var projectProgz:XMLList; 
var projectHyper:XMLList; 

var newsTitle:XMLList; 
var newsInfo:XMLList; 
var newsContent:XMLList; 

var projectNum:Number; 
var newsNum:Number; 

var xml:XMLLoader = new XMLLoader(this,"data.xml"); 

function getXML(xmlData:XML):void { 

    projectTitle = xmlData.projects.project.Title; 
    projectAuthor = xmlData.projects.project.Author; 
    projectImage = xmlData.projects.project.image_path; 
    projectProgz = xmlData.projects.project.Progz; 
    projectHyper = xmlData.projects.project.link; 

    newsTitle = xmlData.news.article.title; 
    newsInfo = xmlData.news.article.info; 
    newsContent = xmlData.news.article.content; 

    projectsNum = projectTitle.length(); 
    newsNum = newsTitle.length(); 

    newsTitleArray = xmlData.news.article.title.text().toXMLString().split("\n") ; 
    newsTitleArray.reverse(); 

    newsInfoArray = xmlData.news.article.info.text().toXMLString().split("\n") ; 
    newsInfoArray.reverse(); 

    newsContentArray = xmlData.news.article.content.text().toXMLString().split("\n") ; 
    newsContentArray.reverse(); 

} 

the source files files

,我不发布任何其他代码因为我不知道错误可能在哪里,但我已经上传the source files files如果你需要他们

+0

在提出有关编译器错误的问题之前,请花时间先查找。简单地将错误粘贴到Google中通常会给您一个答案:http://www.as3errors.com/1120-access-of-undefined-property:http://help.adobe.com/zh_CN/FlashPlatform/reference /actionscript/3/compilerErrors.html – Cadin 2012-02-28 22:33:27

+0

@aymanzzz,请不要使用stackoverflow作为您的调试器。粘贴错误消息并期望别人为你做错误检查不是stackoverflow的目的。 – 2012-02-28 22:42:58

+0

嘿在我身上很容易我仍然是这个@Cadin的菜鸟我搜索谷歌,但我不明白,所以我把这个问题希望有人可以帮助我 – aymanzzz 2012-02-28 23:26:41

回答

0

当看到错误:

1120: Access of undefined property 'VariableName'.

这意味着还没有定义或(访问它时,作为对象/类的属性或功能)声明的变量。这里是一个概述:

1120: Access of undefined property projectsNum. 
projectsNum = projectTitle.length(); // You have declared [var projectNum:Number;] Error source = s --> project[s]Num [Reason #1] 

1120: Access of undefined property newsTitleArray. // I do not see a declaration for this variable [Reason #2] 
newsTitleArray = xmlData.news.article.title.text().toXMLString().split("\n") ; 

1120: Access of undefined property newsTitleArray. // [Reason #2] 

newsTitleArray.reverse(); 

1120: Access of undefined property newsInfoArray. // [Reason #2] 

newsInfoArray = xmlData.news.article.info.text().toXMLString().split("\n") ; 


1120: Access of undefined property newsInfoArray. // [Reason #2] 

newsInfoArray.reverse(); 


1120: Access of undefined property newsContentArray. // [Reason #2] 

newsContentArray = xmlData.news.article.Content.text().toXMLString().split("\n") ; 


1120: Access of undefined property newsContentArray. // [Reason #2] 

newsContentArray.reverse(); 

似乎是一个简单的错误给我。我希望这有帮助。

+0

我明白了。我会确保将来做到这一点。 – 2012-02-28 20:35:08

+0

所以我怎么能声明他们?! – aymanzzz 2012-02-28 20:39:31

+0

@HaleeqUsman我该如何声明他们?! – aymanzzz 2012-02-28 20:45:56