返回列表 回复 发帖

背景方格格填充

AS背景填充特点是体积超小,不到1K,够小了吧!:lol
背景方格格填充  最基本的填充,只是抛砖引玉,在此基础上可以实现各种填充效果,大家跟帖也发点背景效果吧 :lol

//  line 作为画方格的元素
this.createEmptyMovieClip("line", this.getNextHighestDepth());
function drawLine(traget:MovieClip, colLine:Number, colView:Number, X:Number, Y:Number) {
        with (traget) {
                lineStyle(0, colLine, 100);
                beginFill(colView, 100);
                moveTo(0, 0);
                lineTo(X, 0);
                lineTo(X, Y);
                lineTo(0, Y);
                lineTo(0, 0);
                endFill();
                _visible = false;
        }
        //  执行复制函数
        dup(traget);
}
function dup(mc:MovieClip) {
        //  以上述的 line 作为参照标准确定横向和纵向以及总的方格数
        var w:Number = mc._width, h:Number = mc._height, xNum:Number = Math.round(Stage.width/w)*w<=Stage.width ? Math.round(Stage.width/w)+1 : Math.round(Stage.width/w), yNum:Number = Math.round(Stage.height/h)*h<=Stage.height ? Math.round(Stage.height/h)+1 : Math.round(Stage.height/h);
        var w0:Number = 0, h0:Number = 0;
        for (var i:Number = 1; i<=xNum*yNum; i++) {
                this["mc"+i] = duplicateMovieClip(mc, "mc"+i, i);
                this["mc"+i]._x = w0;
                this["mc"+i]._y = h0;
                w0 += w;
                //`` 分行排列   `````````
                if (i%xNum == 0) {
                        w0 = 0;
                        h0 += h;
                }
        }
}
//用 长: 20 宽: 20  的小方格填充
drawLine(line, 0xC9D838, 0xF5F8DC, 20, 20);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

改变其中一点点参数实现的填充效果:

[ 本帖最后由 sxl001 于 2007-10-15 02:12 编辑 ]

背景方格填充.swf (564 Bytes)

背景方格填充.fla (48 KB)

填充2.swf (708 Bytes)

填充3.swf (709 Bytes)

填充4.swf (710 Bytes)

填充5.swf (709 Bytes)

填充6.swf (716 Bytes)

填充7.swf (714 Bytes)

填充8.swf (714 Bytes)

学习,支持!
我的博客http://space.flash8.net/space/?401869
:lol 看不懂
我是仙女
顶一下~~~~~~`:lol
不排斥任何學習的機會!http://www.xsteel.net
顶!~~~~~~~
(虽然看不懂,相信研究几分钟应该可以看懂!)
返回列表