我將TextField實例稱爲inputWord,它在第一幀中不包含任何文本。在同一幀,動作層,當我提到inputWord以任何方式任何時間,有一個錯誤:AS3中的錯誤1009
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at DC/frame1()[DC::frame1:19] //DC is the name of document class that I created.
at flash.display::MovieClip/gotoAndStop()
at DC()[C:\Users\nikkka\Desktop\flash\DC.as:25]
19是我的代碼,涉及inputWord所在行的行號。它的工作原理,我的意思是我寫 inputWord.text =「smth」
它的文字變成了「smth」,但有同樣的錯誤。爲什麼?
是否已進行了確認組件已被呈現? – Kevin
那是怎麼回事? ; O – nicks
太糟糕了,你正在使用Flash而不是Flex。在Flex中,您可以偵聽CREATION_COMPLETE事件,但由於您使用的是Flashm,因此您可以使用Timer類或setTimeout(..)函數來檢查組件是否稍後渲染。 – Kevin