我对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()
我做错了什么?
答案 0 :(得分:0)
看起来对话不是textField。 对话是一个内置文本字段的MovieClip吗?如果是这样,请将textField放在实例名称中,如 tf 。
然后设置如下文字:
Dialogue.tf.text = 'some text';