1
這裏是我的課至今:AS2:類不工作
class com.RCN.Menu.Menu extends MovieClip {
public var title:String;
public var menuItems:Array;
public var titleField:MovieClip;
public function Menu(title:String, menuItems:Array, menuActions:Array) {
this.titleField = createTitleBar(title);
}
public function createTitleBar(title:String) {
var titleBar = createEmptyMovieClip("titleBar", 1);
var titleText = createTextField("titleText", this.getNextHighestDepth(), 10, 10, 100, 100);
titleText.text = title;
titleText.autoSize = true;
titleText.multiline = false;
titleText.wordWrap = false;
titleText.border = true;
titleText.background = 0xffffff;
var format:TextFormat = new TextFormat();
format.font = "Arial";
format.size = 14.5;
format.bold = true;
format.align = "left";
titleText.setTextFormat(format);
return titleBar;
}
}
然而,在我的SWF,當我運行下面的代碼我得到了一個未定義,任何人都可以看到,爲什麼? (新課程)
import com.RCN.Menu.Menu;
var Accountability:Menu = new Menu("hello",[a,b,c,d]);
trace(Accountability.titleField);
感謝