最近学习FLASH,遇到了一个小问题
function xml_load()
{
url_xml.load(xml_url);
url_xml.onLoad = function (sucess)
{
if (sucess)
{
url_data = this.firstChild.childNodes;
menu_len = url_data.length -1;
var _l2 = 1;
while (_l2 < menu_len)
{
var _l3 = url_data[_l2 + 1].childNodes.length;
sub_len_arr.push(_l3);
_l2++;
}
gotoAndPlay("sucess");
}
};
}
function mc_move(num, target)
{
removeMovieClip("holder" + num);
var tgClip = this["main" + num + "_mc"];
this.createEmptyMovieClip("holder"+num,num);
this["holder" + num].onEnterFrame = function ()
{
tgClip._x = tgClip._x + speed * (target - tgClip._x);
if (Math.round(tgClip._x) == target)
{
removeMovieClip(this);
} // end if
};
}
function dbkim(num)
{
if (num < 10)
{
temp_dbkim = "0" + num;
}
else
{
temp_dbkim = String(num);
} // end if
return(temp_dbkim);
} // End of the function
function menu_slide(num)
{
if (num == 1)
{
mc_move(2,350);
mc_move(3,450);
mc_move(4,555);
mc_move(5,655);
mc_move(6,760);
}
else if (num == 2)
{
mc_move(1,280);
mc_move(3,460);
mc_move(4,565);
mc_move(5,665);
mc_move(6,770);
}
else if (num == 3)
{
mc_move(1,280);
mc_move(2,350);
mc_move(4,565);
mc_move(5,665);
mc_move(6,770);
}
else if (num == 4)
{
mc_move(1,280);
mc_move(2,350);
mc_move(3,460);
mc_move(5,665);
mc_move(6,770);
}
else if (num == 5)
{
mc_move(1,280);
mc_move(2,350);
mc_move(3,460);
mc_move(4,565);
mc_move(6,770);
}
else if (num == 6)
{
mc_move(1,280);
mc_move(2,350);
mc_move(3,460);
mc_move(4,565);
mc_move(5,665);
}
else if (num == 0)
{
mc_move(1,275);
mc_move(2,340);
mc_move(3,440);
mc_move(4,545);
mc_move(5,645);
mc_move(6,750);
} // end if// end if
} // End of the function
function menu_con(num, over, push)
{
var _l4 = this["main" + num + "_mc"];
var _l6 = this["menu" + num + "_sub"];
if (over)
{
menu_slide(num);
_l4.onEnterFrame = function ()
{
this.nextFrame();
if (this._currentframe == this._totalframes)
{
delete this["onEnterFrame"];
} // end if
};
_l6.onEnterFrame = function ()
{
this.nextFrame();
if (this._currentframe == this._totalframes)
{
delete this["onEnterFrame"];
} // end if
};
if (push)
{
selected_menu = num;
var _l5 = url_data[num].attributes.url;
var _l3 = url_data[num].attributes.target;
if (link == false)
{
trace("url : " + _l5 + " --------------- target : " + _l3);
}
else
{
getURL(_l5, _l3);
} // end if
} // end if
}
else
{
menu_slide(0);
_l4.onEnterFrame = function ()
{
this.prevFrame();
if (this._currentframe == 1)
{
delete this["onEnterFrame"];
} // end if
};
_l6.onEnterFrame = function ()
{
this.prevFrame();
if (this._currentframe == 1) {
delete this["onEnterFrame"];
} // end if
};
} // end if
} // End of the function
function sub_con(dep1, dep2, over, push)
{
trace("dpe1 : " + dep1 + " dep2 : " + dep2);
var _l7 = this["menu" + dep1 + "_sub"];
var _l4 = _l7["mn" + dep1 + "_sub" + dep2];
if (over)
{
_l4.onEnterFrame = function ()
{
this.nextFrame();
if (this._currentframe == this._totalframes)
{
delete this["onEnterFrame"];
} // end if
};
if (push)
{
selected_menu = dep1;
selected_sub = dep2;
var _l6 = url_data[dep1].childNodes[dep2 - 1].attributes.url;
var _l5 = url_data[dep1].childNodes[dep2 - 1].attributes.target;
if (link == false)
{
trace("url : " + _l6 + " --------------- target : " + _l5);
}
else
{
getURL(_l6, _l5);
} // end if
} // end if
}
else
{
_l4.onEnterFrame = function ()
{
this.prevFrame();
if (this._currentframe == 1)
{
delete this["onEnterFrame"];
} // end if
};
} // end if
} // End of the function
function sub_start(num)
{
var _l5 = sub_len_arr[num - 1];
trace(num);
trace(sub_len_arr[0]);
trace("???? ?? : " + _l5);
var _l3 = this["menu" + num + "_sub"];
_l3.area_mc._alpha = 0;
_l3.area_mc.useHandCursor = false;
_l3.area_mc.onRollOver = function ()
{
menu_con(selected_menu,false,false);
menu_con(num,true,false);
};
_l3.area_mc.onRollOut = _l3.area_mc.onReleaseOutside = function ()
{
menu_con(num, false, false);
menu_con(selected_menu, true, false);
};
var _l2 = 1;
while (_l2 <= _l5)
{
_l3["mn" + num + "_sub" + _l2].onRollOver = function ()
{
var _l2 = this._name.substr(7);
trace("my_num :: " + _l2);
menu_con(selected_menu,false,false);
menu_con(num,true,false);
sub_con(num, selected_sub, false, false);
sub_con(num, _l2, true, false);
};
_l3["mn" + num + "_sub" + _l2].onRollOut = function ()
{
var _l2 = this._name.substr(7);
trace("my_num :: " + _l2);
menu_con(num,false,false);
menu_con(selected_menu, true, false);
sub_con(num, _l2, false, false);
if (num == selected_menu)
{
sub_con(num, selected_sub, true, false);
} // end if
};
_l3["mn" + num + "_sub" + _l2].onRelease = _l3["mn" + num + "_sub" + _l2].onReleaseOutside = function ()
{
var _l2 = this._name.substr(7);
trace("my_num :: " + _l2);
selected_menu = num;
sub_con(num, _l2, true, true);
};
_l2++;
} // end while
sub_con(selected_menu, selected_sub, true, false);
} // End of the function
function menu_start()
{
var i = 0;
while (i < menu_len)
{
var tgClip = eval("main"+Number(i+1)+"_mc");
var subClip = eval("menu" + Number(i + 1) + "_sub");
main_dist_arr[i] = tgClip._x;
tgClip.onRollOver = function ()
{
var _l2 = this._name.substr(4, 1);
menu_con(selected_menu,false,false);
menu_con(_l2,true,false);
};
tgClip.onRollOut = function ()
{
var _l2 = this._name.substr(4, 1);
menu_con(_l2, false, false);
menu_con(selected_menu, true, false);
};
tgClip.onRelease = tgClip.onReleaseOutside = function ()
{
var _l2 = this._name.substr(4, 1);
menu_con(_l2, true, true);
};
i++;
} // end while
} // End of the function
function page_change(url, win)
{
if (link == false)
{
trace("url : " + url + " --------------- target : " + win);
}
else
{
getURL(url, win);
} // end if
} // End of the function
function leftGroup_con()
{
left_data = url_data[0];
reset_btn.onPress = function ()
{
var _l2 = left_data.attributes.url;
var _l1 = left_data.attributes.target;
page_change(_l2, _l1);
};
}
var url_data;
var menu_len;
var sub_len_arr = new Array();
var dirName = "menu";
_global.indexPATH = _url.substr(0, _url.indexOf(dirName)) + dirName + "/";
var xml_url = indexPATH + "top1.xml";
var url_xml = new XML();
url_xml.ignoreWhite = true;
var link;
var selected_menu;
var selected_sub;
var isIntro;
var speed = 0.100000;
xml_load();
这段AS代码,我测试了一下,可以,但是不知道为甚么,第一次按按钮会弹出页面,第二次是不会
连接依靠XML
玩押宝押到只剩下10分
[解决办法]
Url+ "?r=" + Math.random()
把url改变一下试试