0

我收到所有选择文本()行的错误消息 - 每次更改模式值时都会引用该错误消息。

包 { 导入 flash.display.Bitmap; 导入 flash.display.Sprite;导入 flash.events。; 导入 flash.ui.Keyboard;//导入板子;导入 flash.accessibility.AccessibilityImplementation;导入 flash.display.MovieClip;导入 flash.text.TextField;导入 flash.text.TextFormat;导入 flash.display.Sprite;导入 flash.utils.ByteArray;导入 flash.events.MouseEvent;导入 flash.text.AntiAliasType;导入 flash.utils.describeType;导入 flash.net。; 导入集;导入状态框;导入状态x;导入 flash.display.InteractiveObject;导入 flash.text.TextFieldType;导入 flash.events.FocusEvent;导入 fl.managers.FocusManager;导入 flash.display.*;导入 flash.display.Stage;导入 flash.events.KeyboardEvent;

    public class boxsprite extends Sprite  
    {     
        [Embed(source = "C:/Windows/Fonts/Verdana.ttf", fontName = "Verdana", fontWeight = "bold", advancedAntiAliasing = "true", mimeType = "application/x-font")] 
        public static const VERD:Class;
        [Embed(source="../lib/box.gif")]
         private var boxspriteClass:Class
         [Embed(source = "../lib/m2.gif")]
         private var m2:Class
         [Embed(source = "../lib/m3.gif")]
        private var m3:Class
         [Embed(source="../lib/m4.gif")]
        private var m4:Class
        [Embed(source = "../lib/m5.gif")]
        private var m5:Class
        [Embed(source = "../lib/m6.gif")]
        private var m6:Class

        [Embed(source = "../lib/m7.gif")]
        private var m7: Class
        [Embed(source="../lib/m8.gif")]
        private var m8: Class
        [Embed(source = "../lib/m9.gif")]
        private var m9: Class

         internal var mode:uint=1;
            internal var displaytext:String;
            internal var setBox:Boolean = false;
            internal var onBoard:Array = [0];
            internal var playerRound:uint = 1;
            internal var round:uint = 1;
            internal var playernumber:uint; 
            internal var myTextBox:TextField = new TextField();
            public function boxsprite():void
            {
                trace (mode);
            init2(); 
            var boxsprite2:Bitmap = new boxspriteClass() as Bitmap;
            this.addChild(boxsprite2); 
            var m77:Bitmap = new m7 as Bitmap;
            this.addChild(m77)

            var m66:Bitmap = new m6 as Bitmap;
            this.addChild(m66)

            var m55:Bitmap = new m5 as Bitmap;
            this.addChild(m55)
            var m44:Bitmap = new m4 as Bitmap;
            this.addChild(m44)
            var m33:Bitmap = new m3 as Bitmap;
            this.addChild(m33);
            var m22:Bitmap = new m2 as Bitmap;
            this.addChild(m22)
            }

private function choosetext():void
                { switch (mode)
                {
                 case 2: {this.setChildIndex(m22, this.numChildren - 1);}
                case 3: {this.setChildIndex(m33, this.numChildren - 1);}
                case 4: {this.setChildIndex(m44, this.numChildren - 1);}
                case 5: {this.setChildIndex(m55, this.numChildren - 1);}
                case 6: {this.setChildIndex(m66, this.numChildren - 1);}
                case 7: {this.setChildIndex(m77, this.numChildren - 1); }
                case 8: {this.setChildIndex(m88, this.numChildren - 1);  }
                case 9: {this.setChildIndex(m99, this.numChildren - 1); }   
                }
                }
4

1 回答 1

0

尝试将 m22,m33...m99 定义为类变量,而不是在 boxsprite 函数中

public class boxsprite extends Sprite  
{     

   private var m22:Bitmap;

   public function boxsprite():void {

      m22= new m2 as Bitmap;

   }



}
于 2013-09-13T04:02:10.440 回答