作者lovesaber (幻想神)
看板Flash
标题[问题]flash程式码问题
时间Tue Apr 9 22:00:28 2013
程式码如下:
-----------------------------------
const colors:int = 4;
const x_num:int = 10;
const y_num:int = 10;
var colorNum:int;
for (var i:int = 0; i <= (x_num+1); i++) {
for (var j:int = 0; j <= (y_num+1); j++) {
this["block" + i + "_" + j] = new block_mc();
this["block" + i + "_" + j].x = i * 45;
this["block" + i + "_" + j].y = j * 43;
this["block" + i + "_" + j].bx = i;
this["block" + i + "_" + j].by = j;
this["block" + i + "_" + j].bc = 0;
this["block" + i + "_" + j].gotoAndStop("无方块");
this.addChild(this["block" + i + "_" + j]);
}
}
for (i=1; i<=x_num; i++) {
this["newBlock" + i] = new block_mc();
this["newBlock" + i].alpha = 0.2;
this["newBlock" + i].x = i * 45;
this["newBlock" + i].y = 480;
this["newBlock" + i].gotoAndStop("无方块");
this.addChild(this["newBlock" + i]);
}
reset_btn.addEventListener(MouseEvent.CLICK, gameReset);
quit_btn.addEventListener(MouseEvent.CLICK, gameQuit);
function clickBlock(event:MouseEvent) {
var bx:int = event.target.bx;
var by:int = event.target.by;
var bc:int = event.target.bc;
if ( bc > 0 ) {
for (var i:int = 0; i <= (x_num+1); i++) {
for (var j:int = 0; j <= (y_num+1); j++) {
this["temp" + i + "_" + j] = this["block" + i + "_" + j].bc;
}
}
colorNum = 0;
searchBlock(bx,by,bc);
if ( colorNum >=3 ) {
gotoAndPlay("异动更新");
}
}
}
function showButton(event:MouseEvent) {
var bc:int = event.target.bc;
if ( bc > 0 ) {
event.target.buttonMode = true;
}
}
function searchBlock(b_x, b_y, b_c:int) {
colorNum ++;
this["temp" + b_x + "_" + b_y] = 0;
if (this["temp" + (b_x + 1) + "_" + b_y] == b_c) {
searchBlock(b_x + 1, b_y, b_c); // right
}
if (this["temp" + (b_x - 1) + "_" + b_y] == b_c) {
searchBlock(b_x - 1, b_y, b_c); // left
}
if (this["temp" + b_x + "_" + (b_y - 1)] == b_c) {
searchBlock(b_x, b_y - 1, b_c); // up
}
if (this["temp" + b_x + "_" + (b_y + 1)] == b_c) {
searchBlock(b_x, b_y + 1, b_c); // down
}
}
function gameReset(event:MouseEvent) {
gotoAndPlay("游戏开始");
}
function gameQuit(event:MouseEvent) {
fscommand ("quit");
}
--------------------------------------------
当我按下quit_btn这个按钮的时候
完全不会关闭视窗
完全没有反应
跪求高手解决
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 125.224.245.123
1F:→ viceversa56:1.建议改标题关於fscommand语法,後面的人会比较好爬文 04/14 22:33
2F:→ viceversa56:2.我发布後是可关闭,fscommand不能在CTRL+ENTER下执行 04/14 22:33
3F:→ viceversa56:发布成EXE或Swf file下即可执行 04/14 22:35
4F:→ lovesaber:发布成exe或者swf也一样 04/18 18:33