我收到了choosetext()的所有行的错误消息 - 每次更改mode的值时都会引用它。
包 { import flash.display.Bitmap; import flash.display.Sprite; import flash.events。; import flash.ui.Keyboard; //导入板; import flash.accessibility.AccessibilityImplementation; import flash.display.MovieClip; import flash.text.TextField; import flash.text.TextFormat; import flash.display.Sprite; import flash.utils.ByteArray; import flash.events.MouseEvent; import flash.text.AntiAliasType; import flash.utils.describeType; import flash.net。; 进口套装; import StatusBox; 进口Statusx; import flash.display.InteractiveObject; import flash.text.TextFieldType; import flash.events.FocusEvent; import fl.managers.FocusManager; import flash.display。*; import flash.display.Stage; import 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); }
}
}
答案 0 :(得分:0)
尝试将m22,m33 ... m99定义为类变量,而不是在boxsprite函数
中public class boxsprite extends Sprite
{
private var m22:Bitmap;
public function boxsprite():void {
m22= new m2 as Bitmap;
}
}