〖原创〗纯AS涂色游戏

      ActionScript 2004-6-10 22:46
呵呵,以前闲着没事的时候编着玩的:)

//把下面的AS全选,放入FLASH的第一帧中,Ctrl+回车测试
//=============================================================
rmwtTime = "2004年3月26日";
wtft = "AIYI2003";
Mouse.hide();//隐藏鼠标
//============创建空白MC 并在MC内绘制10X10大小的色块===========AIYI2003
_root.createEmptyMovieClip("box", 9999);
with (_root.box) {
    beginFill(0x000000, 100);
    lineStyle(0, 0x000000, 0);
    moveTo(0, 0);
    lineTo(10, 0);
    lineTo(10, 10);
    lineTo(0, 10);
    lineTo(0, 0);
    endFill();
}
//*************创建空白MC 并在MC内绘制10X10大小的色块 END*************
box._visible = 0;
//隐藏BOX
//============216色块===========AIYI2003
box_x = 30;
//色块在主场景X轴上的起始位置
box_y = 50;
aiyi = 1;
for (r=0x00; r<=0xff; r += 0x33) {
    for (g=0x00; g<=0xff; g += 0x33) {
        for (b=0x00; b<=0xff; b += 0x33) {
            duplicateMovieClip("box", "box"+aiyi, aiyi);
            cc = new Color(eval("box"+aiyi));
            if (aiyi<=108) {
                setProperty(eval("box"+aiyi), _x, box_x+int((aiyi-1)/6)*11);
                setProperty(eval("box"+aiyi), _y, box_y+((aiyi-1)%6)*11);
            } else {
                setProperty(eval("box"+aiyi), _x, box_x-(11*18)+int((aiyi-1)/6)*11);
                setProperty(eval("box"+aiyi), _y, box_y+(11*6)+((aiyi-1)%6)*11);
            }
            cc.setRGB(r*256*256+g*256+b);
            aiyi++;
        }
    }
}
//*************216色块 END*************
//=============创建自定义鼠标============AIYI2003
_root.createEmptyMovieClip("aiyi_Mou", 10000);
with (_root.aiyi_Mou) {
    beginFill(0x000000, 100);
    lineStyle(1, 0x000000, 0);
    moveTo(0, 0);
    lineTo(20, 10);
    lineTo(10, 20);
    lineTo(0, 0);
    endFill();
}
//*************创建自定义鼠标 END*************
startDrag("aiyi_Mou", true);
//当鼠标点击后,将自定义鼠标换色。
aiyi_Mou.onMouseDown = function() {
    for (var aiyi_i = 1; aiyi_i<=216; aiyi_i++) {
        if (eval("box"+aiyi_i).hitTest(_xmouse, _ymouse, 1)) {
            nColor = new Color(eval("box"+aiyi_i));
            box = new Color(_root.aiyi_Mou);
            box.setRGB(nColor.getRGB());
            //trace(nColor.getRGB())
            //trace(aiyi_i);
        }
    }
};
//=============改变背景颜色===========
createEmptyMovieClip("bg", -1);
with (bg) {
    beginFill(0xEEEEEE, 100);
    moveTo(0, 0);
    lineTo(Stage.width, 0);
    lineTo(Stage.width, Stage.height);
    lineTo(0, Stage.height);
    lineTo(0, 0);
    endFill();
}
//*************改变背景颜色 END*************
//=============AIYI2003 TEXT=============
_root.createTextField("AIYI2003", 1129, 312, 35, 90, 23);
AIYI2003.selectable = false;
AIYI2003.text = "AIYI2003";
myformat = new TextFormat();
myformat.font = "Arial";
myformat.color = 0x999999;
myformat.size = 18;
AIYI2003.setTextFormat(myformat);
//========高亮部份
_root.createTextField("AIYI2003g", 1128, 311, 34, 90, 23);
AIYI2003g.selectable = false;
AIYI2003g.text = "AIYI2003";
myf = new TextFormat();
myf.font = "Arial";
myf.color = 0xffffff;
myf.size = 18;
AIYI2003g.setTextFormat(myf);
//*************AIYI2003 TEXT END**********
//=============游戏标题================
_root.createEmptyMovieClip("gameT", 498);
gameT._x = 170;
gameT._y = 3;
with (gameT) {
    createTextField("gameText", 499, 0, 0, 250, 47);
    gameText.text = "纯AS涂色游戏";
    gameText.selectable = false;
    myformat = new TextFormat();
    myformat.color = 0xff0000;
    myformat.size = 30;
    gameText.setTextFormat(myformat);
}
//*************游戏标题 END**************
//=============游戏标题高亮部份================
createTextField("gameText2", 495, 169, 2, 250, 47);
gameText2.text = "纯AS涂色游戏";
gameText2.selectable = false;
myformat2 = new TextFormat();
myformat2.color = 0xffffcc;
myformat2.size = 30;
gameText2.setTextFormat(myformat2);
//=============HTMLTEXT=================
_root.createTextField("flash8", 1000, 495, 360, 40, 18);
flash8.selectable = false;
flash8.html = true;
flash8.htmlText = "<a href='http://www.flash8.net/bbs'>闪吧 </a>";
_root.createTextField("flashercn", 1001, 485, 380, 70, 18);
flashercn.selectable = false;
flashercn.html = true;
flashercn.htmlText = "<a href='http://www.flasher.cn'>闪客天堂 </a>";
//*************HTMLTEXT END**********************
//=============创建bgImage影片剪辑=================
_root.createEmptyMovieClip("bgImage", 512);
with (_root.bgImage) {
    createEmptyMovieClip("bg1", 600);
    with (bg1) {
        //烟囱 (180,200) (200,200) (200,240) (180,240) (180,200)
        beginFill(0x999999, 100);
        lineStyle(1, 0x000000, 20);
        moveTo(180, 200);
        lineTo(200, 200);
        lineTo(200, 240);
        lineTo(180, 240);
        lineTo(180, 200);
        endFill();
    }
    createEmptyMovieClip("bg2", 602);
    with (bg2) {
        //房盖 (100,240) (220,240) (260,280) (60,280) (100,240)
        beginFill(0x999999, 100);
        lineStyle(1, 0x000000, 20);
        moveTo(100, 240);
        lineTo(220, 240);
        lineTo(260, 280);
        lineTo(60, 280);
        lineTo(100, 240);
        endFill();
    }
    createEmptyMovieClip("bg3", 603);
    with (bg3) {
        //房子
        beginFill(0x999999, 100);
        lineStyle(1, 0x000000, 20);
        moveTo(60, 280);
        lineTo(260, 280);
        lineTo(260, 380);
        lineTo(240, 380);
        lineTo(240, 320);
        lineTo(240, 320);
        lineTo(200, 320);
        lineTo(200, 380);
        lineTo(60, 380);
        lineTo(60, 280);
        endFill();
    }
    createEmptyMovieClip("bg4", 604);
    with (bg4) {
        //门
        beginFill(0x999999, 100);
        lineStyle(1, 0x000000, 20);
        moveTo(200, 320);
        lineTo(240, 320);
        lineTo(240, 380);
        lineTo(200, 380);
        lineTo(200, 320);
        endFill();
    }
    createEmptyMovieClip("bg5", 605);
    with (bg5) {
        //A
        beginFill(0x999999, 100);
        lineStyle(1, 0x000000, 0);
        moveTo(320, 300);
        lineTo(340, 300);
        lineTo(360, 320);
        lineTo(360, 360);
        lineTo(340, 360);
        lineTo(340, 340);
        lineTo(320, 340);
        lineTo(320, 360);
        lineTo(300, 360);
        lineTo(300, 320);
        lineTo(320, 300);
    }
    createEmptyMovieClip("bg6", 606);
    with (bg6) {
        //I
        beginFill(0x999999, 100);
        lineStyle(1, 0x000000, 0);
        moveTo(380, 300);
        lineTo(400, 300);
        lineTo(400, 360);
        lineTo(380, 360);
        lineTo(380, 300);
    }
    createEmptyMovieClip("bg7", 607);
    with (bg7) {
        //Y
        beginFill(0x999999, 100);
        lineStyle(1, 0x000000, 0);
        moveTo(420, 300);
        lineTo(440, 300);
        lineTo(440, 320);
        lineTo(460, 320);
        lineTo(460, 300);
        lineTo(480, 300);
        lineTo(480, 340);
        lineTo(460, 340);
        lineTo(460, 360);
        lineTo(440, 360);
        lineTo(440, 340);
        lineTo(420, 340);
        lineTo(420, 300);
    }
    createEmptyMovieClip("bg8", 608);
    with (bg8) {
        //I
        beginFill(0x999999, 100);
        lineStyle(1, 0x000000, 0);
        moveTo(500, 300);
        lineTo(520, 300);
        lineTo(520, 360);
        lineTo(500, 360);
        lineTo(500, 300);
    }
    createEmptyMovieClip("bg9", 609);
    with (bg9) {
        //太阳
        lineStyle(1, 0x000000, 0);
        beginFill(0x999999);
        moveTo(100, 100);
        curveTo(120, 100, 120, 80);
        curveTo(120, 60, 100, 60);
        curveTo(80, 60, 80, 80);
        curveTo(80, 100, 100, 100);
        endFill();
    }
    bg9._x = 360;
    bg9._y = 20;
}
//*************创建bgImage影片剪辑 END***************
//=============鼠标点击变色==============AIYI2003
bgImage.onRelease = function() {
    for (aiyi in bgImage) {
        if (bgImage[aiyi].hitTest(_xmouse, _ymouse, 1)) {
            var n_color = new Color(bgImage[aiyi]);
            n_color.setRGB(_root.box.getRGB());
        }
    }
};
//**************鼠标点击变色 END***************
//==============双击恢复默认颜色===============AIYI2003
_root.onMouseDown = function() {
    time = getTimer()-down_time;
    if (time<300) {
        for (aiyi in bgImage) {
            if (typeof (bgImage[aiyi]) == "movieclip") {
                var NEW_Color = new Color(bgImage[aiyi]);
                NEW_Color.setRGB(0x999999);
            }
        }
    }
    down_time = getTimer();
};
//*************双击恢复默认颜色 END**************
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}
}