qq扫一扫文字提取ipad:逐渐出现的马赛克遮照 转 - Flash互助课堂 - 中国教程网论坛 互助学习交流平台

来源:百度文库 编辑:偶看新闻 时间:2024/04/29 16:40:23
首先在场景中导入一个图片 把它转换为影片剪辑
把影片剪辑放在主场景第一针
在该影片剪辑上写下如下AS

onClipEvent (load)//当影片剪辑出现在时间轴上时,执行大括号里的语句 {
numY = 56;
numY = 70;//定义图象显示的尺寸
numPerFrame = 60//定义针速
currSquare = 0;
choices = new Array();
for (i=0; ichoices.push(i);//定义一个新的数组 并不断增加数组长度
}
_root.createEmptyMovieClip("mask", 0);//
this.setMask(_root.mask);//创建一个影片剪辑 作为遮照
function drawSquare(x, y) {
with (_root.mask) {
moveTo(x, y);
beginFill(0x000088);
lineTo(x+10, y);
lineTo(x+10, y+10);
lineTo(x, y+10);
endFill();//画出这个遮照, 形状为10*10象素的方块
}
}
}
onClipEvent (enterFrame)//影片剪辑针频不断触发此动作 {
if (currSquarefor (i=0; ij = random(choices.length);
t = choices[j];
choices[j] = choices[choices.length-1];随机选择方快出现的时间
choices.pop();//开始删除数组choices中的元素
x = t%numX;
y = Math.floor(t/numX);//返回参数中表达式的下限值
drawSquare(x*10, y*10);
}
currSquare += numPerFrame;
this._alpha = currSquare/(numX*numY)*100;//设置透明度
}
}好了现在可以导出看效果了