2012-02-28 133 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