这是我在这里发表的第二篇文章,第一篇由于对好成员的了解而迅速得到解决。所以我想再试一次,如果你可以帮助那将是美妙的。这是一个班级项目...而且我再次陷入困境......
这是我的代码:
// TOP NAVIGATION - OVER ADDING CHILD //
var dest5:Number = -23;
var home_button:mc_home1 = new mc_home1();
var globe_button:mc_globe1 = new mc_globe1();
var game_button:mc_game1 = new mc_game1();
var info_button:mc_info1 = new mc_info1();
var menudown_dest:Number = 58.9;
var menudown_dest_back:Number = -58.9;
function top_menu_bg(event:Event):void{
if (dest5 != mc_top.y){
var easeNum:Number = 0.93
mc_top_bar.y = mc_top_bar.y * easeNum + dest5 * (1-easeNum);
}
if (mc_top_bar.y >= -23) {
function top_menu_down(event:MouseEvent):void{
if (menudown_dest != mc_top_bar.y)
var easeNum:Number = 0.93
mc_top_bar.y = mc_top_bar.y * easeNum + menudown_dest * (1-easeNum);
}
if (mc_top_bar.y >= 42.95)
{
addChild(home_button);
home_button.x = 472.95;
home_button.y = 39.15;
addChild(globe_button);
globe_button.x = 582.95;
globe_button.y = 39.65;
addChild(game_button);
game_button.x = 699.95;
game_button.y = 38.15;
addChild(info_button);
info_button.x = 812.95;
info_button.y = 39.15;
removeEventListener(Event.ENTER_FRAME, top_menu_bg);
}
mc_top_bar.addEventListener(MouseEvent.MOUSE_OVER, top_menu_down);
}
if (mc_top_bar.y >= 50.9) {
function top_menu_bg_backup (event:MouseEvent):void{
mc_top_bar.removeEventListener(MouseEvent.MOUSE_OVER, top_menu_down);
if (menudown_dest_back != mc_top.y)
var easeNum:Number = 0.93
trace("hello1")
mc_top_bar.y = mc_top_bar.y * easeNum + menudown_dest_back * (1-easeNum);
}
if (mc_top_bar.y >= 50)
{
removeChild(home_button);
removeChild(globe_button);
removeChild(game_button);
removeChild(info_button);
trace("hello2")
}
mc_top_bar.addEventListener(MouseEvent.MOUSE_OUT, top_menu_bg_backup);
}
}
addEventListener(Event.ENTER_FRAME, top_menu_bg);
所以一切都有效,直到函数top_menu_bg_backup,因为我正在跟踪它...而且无法追踪......
我正在尝试尽可能地简化我的代码。这是我第一次参加AS3项目。仍然要求同一个项目...抱歉
答案 0 :(得分:0)
if (menudown_dest_back != mc_top.y)
var easeNum:Number = 0.93
这段代码没有多大意义。 easeNum的变量声明只存在于该行上,并且分配给它的值在其他任何地方都不可用。也许你错过了一对花括号?