2

我对 actionscript 3.0 还很陌生,而且我不断收到上面的错误。我的代码是

stop();
Lamp.addEventListener(MouseEvent.CLICK,lookatlamp);
function lookatlamp(event:MouseEvent){
Dialogue.text = "It is a very bright lamp. It hurts your eyes.";
}
Room.addEventListener(MouseEvent.CLICK,standup);
function standup(event:MouseEvent){
gotoAndStop(2);
}

第 2 帧:

stop();
Table.addEventListener(MouseEvent.CLICK,lookatthetable);
function lookatthetable(event:MouseEvent){
gotoAndStop(4);
}
FirstDoor.addEventListener(MouseEvent.CLICK,gotonextroom);
function gotonextroom(event:MouseEvent){
gotoAndStop(3);
}

框架 3:

stop();
Inspctdr.addEventListener(MouseEvent.CLICK,lookatthedoor);
function lookatthedoor(event:MouseEvent){
Dialogue.text = "It is a metal door with a shiny silver handle.";
}

完整的错误是:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::TextField@119c83d1 to flash.display.MovieClip.

at flash.display::MovieClip/gotoAndStop()
at Untitled_fla::MainTimeline/standup()

TypeError: Error #1034: Type Coercion failed: cannot convert flash.text::TextField@119c8449 to flash.display.MovieClip.

at flash.display::MovieClip/gotoAndStop()
at Untitled_fla::MainTimeline/lookatthetable()

我做错了什么?

4

1 回答 1

0

看起来对话不是文本字段。Dialogue是一个带有文本字段的 MovieClip 吗?如果是这样,请在实例名称中提供 textField ,例如tf

然后将文本设置为:

Dialogue.tf.text = 'some text';
于 2013-09-13T22:09:35.723 回答