这不会响应按 Enter -traces 没有结果。
有什么方法可以做到这一点吗?
这只是为了克服可笑的发帖限制而写的更加荒谬的文章。
雅达。
板子.as
package
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.*;
import flash.ui.Keyboard;
import mx.core.BitmapAsset;
//import board;
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 Set;
import StatusBox;
import 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
private var m22:Bitmap;
private var m33:Bitmap;
private var m44:Bitmap;
private var m55:Bitmap;
private var m66:Bitmap;
private var m77:Bitmap;
private var m88:Bitmap;
private var m99:Bitmap;
private var boxsprite2:Bitmap;
internal var mode:uint=2;
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);
boxsprite2=new boxspriteClass() as Bitmap;
this.addChild(boxsprite2);
m22 = new m2 as Bitmap;
this.addChild(m22);
m77= new m7 as Bitmap;
this.addChild(m77);
m66= new m6 as Bitmap;
this.addChild(m66);
m55= new m5 as Bitmap;
this.addChild(m55);
m44= new m4 as Bitmap;
this.addChild(m44);
m33= new m3 as Bitmap;
this.addChild(m33);
this.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown2);
}
private function myKeyDown2(e2:KeyboardEvent):void
{
if (e2.keyCode == Keyboard.ENTER)
{
trace("Enter pressed");
modeswitch();
}
else if (e2.keyCode ==Keyboard.H)
{
navigateToURL(new URLRequest("http://wp.me/P3FUQl-n"));
}
//else if (e.Keycode == Keyboard.Q)
function modeswitch():void
{ trace(mode);
switch(mode)
{
case 8:
{mode = 9;
choosetext(); }
case 9:
{mode = 2;
choosetext();
}
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
{mode = 3;
choosetext();}
startBox.addEventListener(KeyboardEvent.KEY_DOWN, kill);
此代码部分
Board.as- 似乎工作。
function kill (e2:KeyboardEvent):void
{if (e2.keyCode == Keyboard.NUMBER_1)
{removeChild(this.startBox);
startBox = null;
}
else if (e2.keyCode == Keyboard.NUMBER_2)
{removeChild(this.startBox);
startBox = null;
}
else if (e2.keyCode == Keyboard.NUMBER_3)
{removeChild(this.startBox);
startBox = null;
}
else if (e2.keyCode == Keyboard.NUMBER_4)
{removeChild(this.startBox);
startBox = null;
}
else if (e2.keyCode == Keyboard.NUMBER_5)
{removeChild(startBox);
startBox = null; }
else if (e2.keyCode == Keyboard.NUMBER_6)
{ removeChild(this.board.startBox);
startBox = null;}
else if (e2.keyCode == Keyboard.ENTER)
{removeChild(startBox);
startBox = null;}
也许我已经放弃了这部分的键盘并改用鼠标事件 - 在以前的结构中我无法做到这一点,因为鼠标已经被占用做某事但现在应该释放。
顺便说一句,这不需要在舞台初始化。