我正在使用裸 ActionScript 3.0 从基本的 Flash UI 组件构建一个简单的菜单,并且Label
在电影测试期间第一个控件没有显示(Ctrl+Enter)
。这是为什么?
我在图书馆或舞台上没有任何符号。我的文档链接到main.as
应该发生的是,当.swf启动时,main()
会收到生成指令,而该指令mainMenu
又会在电影屏幕的中心顶部显示唯一的标签。
主文件
package {
import flash.display.*;
public class main extends MovieClip{
public function main(){
changeState(null, "mainMenu");
}
public function changeState(currentState, nextState){
if(currentState != null){
removeChild(currentState);
}
if(nextState == "mainMenu"){
var main_menu:mainMenu = new mainMenu(changeState);
addChild(main_menu);
}// else if(nextState == "deckManager"){
// var deck_manager:deckManager = new deckManager(changeState);
// addChild(deck_manager);
// }
}
}
}
主菜单.as
package {
import flash.display.*;
import flash.events.MouseEvent;
import fl.controls.Label;
import fl.controls.RadioButton;
import fl.controls.ComboBox;
import fl.controls.Button;
public class mainMenu extends Sprite{
const difficultyRadioGroupName:String = "difficultyGroup"; // group name for easy, normal and hard difficulty radio buttons
var difficultyLabel:Label; // "Difficulty" label
var easyDifficultyRadio:RadioButton; // "Easy" difficulty radio button
var normalDifficultyRadio:RadioButton; // "Normal" difficulty radio button
var hardDifficultyRadio:RadioButton; // "Hard" difficulty radio button
var yourDeckLabel:Label; // "Your deck" label
var yourDeckCombo:ComboBox; // combobox to select your deck(1)
var editSelectedDeckButton:Button; // button to edit currently selected deck
var startTheGameButton:Button; // button to start the game
var theCallbackFunction:Function; // callback function to change between mainMenu and deckManager
public function mainMenu(callback){
// create and position the difficulty label
difficultyLabel = new Label();
difficultyLabel.text = "Difficulty";
difficultyLabel.x = width / 2;
difficultyLabel.y = height / 4;
addChild(difficultyLabel);
theCallbackFunction = callback;
}
//public function backButtonClicked(evt:MouseEvent){
// theCallbackFunction(this, "back");
// return;
// }
}
}