我是编码新手,我正在阅读教程,现在我在 actionscript 3.0 中遇到错误,我试图制作一个文本字段来检测文本输入事件并在其中显示它,
1119: Access of possibly undefined property text through a reference with static type Function.
脚本文件将影片剪辑与输入文本字段链接 符号名为 type
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.events.TextEvent;
import flash.text.TextField;
public class text extends MovieClip
{
function type()
{
addEventListener(TextEvent.TEXT_INPUT, updateOutput);
}
function updateOutput(event:TextEvent):void
{
var pressedKey:String = event.text;
type.text = "You typed: " + pressedKey;
}
}
}