创建
BitmapData类的noise方法轻松创建电视花屏效果。点击查看Flash:
http://space.flash8.net/bbs/attachment.php?aid=311480
主场景第一帧:
右键菜单 = new ContextMenu();
右键菜单.hideBuiltInItems();
右键菜单.customItems.push(new ContextMenuItem(’sxl001’, dj_menu0, false));
function dj_menu0() {
getURL(’http://space.flash8.net/space/?572002’, ’_blank’);
}
_root.menu = 右键菜单;
Stage.scaleMode = "noScale";
import flash.display.BitmapData;
var myBitmapData:BitmapData = new BitmapData(400, 300);
this.createEmptyMovieClip("myMovieClip2", 1);
myMovieClip2._x = myMovieClip0._x;
myMovieClip2._y = myMovieClip0._y;
myMovieClip2.attachBitmap(myBitmapData, 1);
_global.k = 1;
function run() {
if (myMovieClip0._currentframe>7) {
myMovieClip0.gotoAndStop(1);
}
myBitmapData.noise(Math.floor(1000*Math.random()), 0, 255, 1 | 2 | 4 | 8, false);
myMovieClip2._alpha -= 2;
if (myMovieClip2._alpha<=1) {
k++;
myMovieClip2._alpha = 100;
myMovieClip0.nextFrame();
for (var i = 1; i<=7; i++) {
if (i == k) {
this["m"+i].mm.gotoAndStop(2);
} else {
this["m"+i].mm.gotoAndStop(1);
}
}
if (k>7) {
k = 1;
m1.mm.gotoAndStop(2);
myMovieClip0.gotoAndStop(1);
}
}
}
for (var i = 1; i<=7; i++) {
this["m"+i].gotoAndStop(i);
this["m"+i].mm.gotoAndStop(1);
}
myMovieClip0.gotoAndStop(1);
m1.mm.gotoAndStop(2);
_root.onEnterFrame = run;
for (var i = 1; i<=7; i++) {
this["m"+i].no = i;
this["m"+i].onPress = function() {
delete _root.onEnterFrame;
_root.onEnterFrame = run;
for (var j = 1; j<=7; j++) {
if (j == this.no) {
k = j;
_root.myMovieClip0.gotoAndStop(j);
_root["m"+j].mm.gotoAndStop(2);
} else {
_root["m"+j].mm.gotoAndStop(1);
}
}
};
}