我正在用基本的Flash UI組件構建一個簡單的菜單,使用純ActionScript 3.0,並且在電影測試(Ctrl+Enter)
期間不會顯示第一個Label
控件。這是爲什麼?Label is not up up
我在圖書館或舞臺上沒有任何符號。我的文檔鏈接到main.as
當瑞士法郎啓動main()
得到指令生成mainMenu
這反過來將在電影的中心頂部顯示的唯一標籤應該怎樣發生的屏幕。
main.as
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);
// }
}
}
}
mainMenu.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;
// }
}
}
有趣! Flash IDE(Flash CS5/6或其他)與我的老朋友Flash Builder是不同的動物:) – 2012-08-08 17:14:09