AS3文件必须有个外部可见的定义

来源:百度知道 编辑:UC知道 时间:2024/05/30 08:52:30
package com.Lzd.as3bible{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
public class Example extends Sprite {
public function Example() {
var tf:TextField=new TextField ;
tf.multiline=true;
tf.wordWrap=true;
tf.width=stage.stageWidth;
tf.height=stage.stageHeight;
tf.text="Congratulation! You just ran an"+"example from the ActionScript 3.0 Bible!";
var format:TextFormat=new TextFormat ;
format,font="_sans";
format.size=42;
tf.setTextFormat(format);
addChild(tf);
trace("Done!");
}
}
}
路径是对的啊。 怎么显示文件必须有个外部可见的定义啊。 什么意思啊。 高手进来帮忙啊。!
还有包不能嵌套是什么意思?

这个AS文件的文件名必须是Example.as
最好放置在你代码根目录/com/Lzd/as3bible/ 目录

然后这儿写错了:
format,font="_sans";
把中间的逗号改成点号:
format.font="_sans";

其他的我这里AS3环境编译通过,没问题的。如果你满足我说的情况,然后还有编译错误,那检查一下你是不是用AS3的编译器去编译。AS2和AS3差别非常大。