效果如下:
//----------右键菜单------------------------------------
function f1() { //右键菜单函数
getURL("http://game.tmxk.net/flasher");
}
function f2() {
gotoAndPlay(8);
}
var m1 = new ContextMenu(); //建新菜单
m1.hideBuiltInItems();
m1.customItems.push(new ContextMenuItem("我的站点", f1, true));//右键菜单项
m1.customItems.push(new ContextMenuItem("重新开始", f2, true));
_root.menu = m1;
//------------------------
var str; //用数组建地图,0表示空,也是方块能移到的地方,65表示墙
str = [[0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 65, 65, 65, 65, 65], [65, 65, 65, 65, 65, 65, 0, 0, 0, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 65, 0, 65, 0, 65, 65, 0, 65, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65], [65, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 65, 0, 0, 0, 0, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 65, 0, 65, 0, 65, 65, 0, 65, 65, 0, 65, 65, 65, 0, 0, 0, 0, 0], [65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 0, 0, 65, 65, 65, 65, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 65, 0, 65, 0, 65, 0, 0, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65], [65, 0, 65, 0, 0, 0, 0, 0, 0, 65, 0, 65, 0, 0, 0, 65, 0, 65, 0, 65, 0, 65, 65, 65, 65, 65, 0, 65, 0, 65, 0, 65, 0, 65, 0, 65, 0, 0, 0, 0, 0, 0, 0, 65, 65], [65, 0, 65, 0, 65, 65, 65, 65, 0, 65, 0, 65, 65, 65, 0, 65, 0, 65, 0, 65, 0, 0, 0, 0, 0, 0, 0, 65, 0, 65, 0, 65, 0, 65, 0, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65], [65, 0, 65, 0, 65, 65, 0, 65, 0, 65, 65, 65, 65, 65, 0, 65, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65], [0, 0, 65, 0, 0, 65, 0, 65, 0, 65, 0, 0, 65, 65, 0, 65, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65], [65, 0, 65, 0, 0, 65, 0, 65, 0, 65, 0, 0, 0, 0, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 65], [65, 0, 65, 65, 0, 65, 0, 65, 0, 65, 0, 65, 65, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 65, 0, 65, 65, 65, 65, 65, 0, 65, 0, 65, 65, 0, 65, 65], [65, 0, 65, 65, 0, 65, 0, 65, 0, 65, 0, 65, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 65, 65, 65, 65, 65, 0, 0, 0, 65, 65, 0, 65, 65], [65, 0, 0, 0, 0, 65, 0, 65, 0, 65, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65], [0, 0, 65, 0, 65, 65, 0, 65, 0, 0, 0, 65, 65, 0, 65, 65, 65, 0, 0, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 0, 0, 65, 65, 65, 65, 65, 0, 0, 65, 65, 65, 0, 0, 0], [0, 65, 65, 0, 65, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 65, 0], [0, 65, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 65, 65, 65, 65, 65, 0, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 65, 65], [0, 0, 0, 0, 65, 65, 65, 0, 0, 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 65, 65, 0, 65, 0, 65, 0, 65, 65], [65, 65, 65, 0, 65, 65, 65, 65, 0, 65, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 65, 65, 0, 0, 65, 0, 65, 0, 0, 65], [65, 0, 65, 0, 0, 0, 65, 65, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 0, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 0, 65, 65, 0, 65, 65, 0, 0, 65, 0, 65], [65, 0, 65, 0, 65, 0, 65, 0, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 65, 0, 65, 65, 0, 65, 65, 65, 0, 65, 0, 65], [0, 0, 65, 0, 65, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 0, 0, 65, 65, 65, 0, 65, 65, 65, 65, 65, 0, 65, 65, 0, 65, 0, 0, 0, 65, 0, 65], [0, 65, 65, 0, 65, 0, 65, 0, 65, 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 65, 65, 0, 65, 65, 0, 65, 0, 65, 0, 65, 0, 65], [0, 65, 65, 0, 65, 0, 65, 0, 0, 65, 65, 0, 0, 0, 0, 65, 65, 65, 0, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 0, 0, 0, 65, 0, 0, 65, 65, 0, 65, 0, 65, 0, 65, 0, 65], [0, 65, 65, 65, 65, 0, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 0, 65, 0, 65, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 65, 0, 0, 0, 65, 65, 65, 0, 65, 0, 65, 0, 65, 0, 65], [0, 0, 0, 0, 0, 0, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 65, 0, 65, 0, 65, 0, 0], [0, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 0, 65, 65, 65, 0, 65], [0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 65, 0, 0, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 65], [0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 65, 0, 65, 65, 0, 0, 0, 65, 65, 65, 0, 65, 65, 65, 65, 0, 65, 0, 0, 0, 0, 65, 65, 65, 65, 65, 65, 0, 65], [0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 0, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 65, 0, 65, 0, 65, 0, 65, 65, 0, 65, 0, 0, 65, 0, 65, 0, 65], [0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 0, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 65, 0, 65, 65, 0, 65, 65, 0, 65, 0, 65, 0, 65], [0, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 65, 65, 0, 65, 65, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 65, 0, 0, 0, 65, 65, 0, 65, 65, 0, 0, 0, 65, 0, 65], [0, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 65, 65, 0, 65, 65, 0, 65, 65, 65, 65, 65, 0, 65, 65, 65, 0, 65, 0, 65, 65, 0, 65, 65, 65, 0, 0, 65, 65, 65, 65, 65, 65, 0, 65], [65, 0, 0, 0, 0, 0, 65, 65, 65, 65, 0, 65, 65, 0, 65, 0, 0, 65, 65, 65, 65, 65, 0, 65, 0, 0, 0, 65, 0, 65, 65, 0, 65, 65, 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 65], [65, 0, 65, 65, 65, 0, 0, 0, 0, 0, 0, 65, 65, 0, 65, 0, 65, 65, 0, 0, 0, 65, 0, 65, 0, 65, 65, 0, 0, 65, 0, 0, 65, 65, 0, 65, 0, 65, 65, 0, 65, 65, 65, 0, 65], [65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 65, 65, 65, 65, 0, 0, 0, 65, 0, 65, 65, 0, 0, 0, 0, 65, 0, 0, 0, 65, 0, 65, 65, 0, 0, 0, 65, 0, 65], [65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 65, 0, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 65, 65, 65, 65, 0, 0, 65, 65, 65, 0, 65, 65, 65, 65, 0, 65, 0, 65], [0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 0, 65, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 0, 0, 65, 65, 65, 65, 0, 0, 0, 0,