0

我不确定为什么会产生这个错误,因为它在幻灯片 5 之前完美运行。

TypeError: Error #2007: Parameter text must be non-null.
    at flash.text::TextField/set text()
    at rlo_fla::Question_15/updateTextFunction()[rlo_fla.Question_15::frame1:17]
    at Main/frame6()[Main::frame6:31]
    at flash.display::MovieClip/gotoAndStop()
    at Main/Answer()[Main::frame5:44]

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Main/clickInfoLoopFunction()[/Users/Kristian/Dropbox/University of Westminster/RLO/Project/Main.as:238]

.fla 和 .as 在我的 git 上可用:https ://github.com/EpicKris/rlo

抱歉,我无法提供更多见解,我只是非常不确定问题的性质。

4

1 回答 1

0

In the function clickInfoLoopFunction(), you call:

infoMC.updateTextFunction(textO['Topic ' + currentTopicI + ' Slide ' + currentSlideI + ' Info']);

The problem is that the value of either currentTopicI or currentSlideI became something unexpected, and tried to access a property that doesn't exist in textO. If you run into this error again, trace the output of currentTopicI and currentSlideI right before this line. Then you'll figure out that, for example, the program was trying to call textO['Topic928Slide-5Info']. Of course, after that you'll have to figure out why those values changed unexpectedly, but this is a start.

EDIT : There are two main problems

1) You have a number of MovieClips in the FLA with functions in them to update text in a TextField. Right now they try to set the text even if the parameter is null. So prevent that by wrapping the text-setting lines with:

if (theParameter != null) { }

2) In Main.as, in the function clickInfoLoopFunction(), infoMC.updateTextFunction(textO['... gets called, but sometimes infoMC itself is null, so only call this function when infoMC exists:

if (infoMC) infoMC.updateTextFunction(textO['Topic ' + currentTopicI + ' Slide ' + currentSlideI + ' Info']);
于 2012-07-18T02:02:45.060 回答