求解:关于flash as2.0代码的问题?
for(i=1;i<37;i++){this.attachMovie("pic"+i,"pic"+i+"_mc",this.getNextHighestDepth());...
for(i=1;i<37;i++){
this.attachMovie("pic"+i,"pic"+i+"_mc",this.getNextHighestDepth()); var pic_mc = eval("pic"+i+"_mc"); pic_mc._x = 150 +random(200); pic_mc._y = 100 + random(200); } pic1_mc.onRelease = function(){ var zddepth =_root.getNextHighestDepth()-1; var zd_mc:MovieClip =_root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); } pic2_mc.onRelease = function(){ var zddepth = _root.getNextHighestDepth()-1; var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); } pic3_mc.onRelease = function(){ var zddepth = _root.getNextHighestDepth()-1; var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); } pic4_mc.onRelease = function(){ var zddepth = _root.getNextHighestDepth()-1; var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); } pic5_mc.onRelease = function(){ var zddepth = _root.getNextHighestDepth()-1; var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); }
请帮忙解释一下上述代码的意思 展开
this.attachMovie("pic"+i,"pic"+i+"_mc",this.getNextHighestDepth()); var pic_mc = eval("pic"+i+"_mc"); pic_mc._x = 150 +random(200); pic_mc._y = 100 + random(200); } pic1_mc.onRelease = function(){ var zddepth =_root.getNextHighestDepth()-1; var zd_mc:MovieClip =_root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); } pic2_mc.onRelease = function(){ var zddepth = _root.getNextHighestDepth()-1; var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); } pic3_mc.onRelease = function(){ var zddepth = _root.getNextHighestDepth()-1; var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); } pic4_mc.onRelease = function(){ var zddepth = _root.getNextHighestDepth()-1; var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); } pic5_mc.onRelease = function(){ var zddepth = _root.getNextHighestDepth()-1; var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth); this.swapDepths(zd_mc); }
请帮忙解释一下上述代码的意思 展开
1个回答
展开全部
//从库里面调出35图片(这里是影片剪辑),
for (i = 1; i < 37; i++)
{
this.attachMovie("pic" + i,"pic" + i + "_mc",this.getNextHighestDepth());
//对这些mc民命
var pic_mc = eval("pic" + i + "_mc");
//随机他们的坐标
pic_mc._x = 150 + random(200);
pic_mc._y = 100 + random(200);
}
//以下是对这些按钮添加点击事件,
pic1_mc.onRelease = function()
{
//把当前点击的这个图片(影片剪辑)放到舞台最上层。
var zddepth = _root.getNextHighestDepth() - 1;
var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth);
this.swapDepths(zd_mc);
};
pic2_mc.onRelease = function()
{
var zddepth = _root.getNextHighestDepth() - 1;
var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth);
this.swapDepths(zd_mc);
};
pic3_mc.onRelease = function()
{
var zddepth = _root.getNextHighestDepth() - 1;
var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth);
this.swapDepths(zd_mc);
};
pic4_mc.onRelease = function()
{
var zddepth = _root.getNextHighestDepth() - 1;
var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth);
this.swapDepths(zd_mc);
};
pic5_mc.onRelease = function()
{
var zddepth = _root.getNextHighestDepth() - 1;
var zd_mc:MovieClip = _root.getInstanceAtDepth(zddepth);
this.swapDepths(zd_mc);
};
//上面的写法很不科学
//你可以使用下面的写法
for (i = 1; i < 37; i++)
{
this.attachMovie("pic" + i,"pic" + i + "_mc",this.getNextHighestDepth());
//对这些mc民命
var pic_mc = eval("pic" + i + "_mc");
//随机他们的坐标
pic_mc._x = 150 + random(200);
pic_mc._y = 100 + random(200);
pic_mc.onRelease = function()
{
var zddepth = _root.getNextHighestDepth() - 1;
var pic_mc:MovieClip = _root.getInstanceAtDepth(zddepth);
this.swapDepths(pic_mc);
};
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询