镜面效果 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

   

    将一个正向的图形制作成可以水平、竖直,任意翻转的效果,

镜面效果

。支持动态字体,只支持固定大小设定。不能检测mc的当前大小,因为遮罩外的面积以及字体框的面积都会增加出来白框。

   

    代码如下:

    import flash.display.BitmapData;

    import flash.geom.Matrix;

    import com_zszen.spirit.create;

    function mirror(mc:MovieClip,objSet:Object, newMC:String, type:String) {

    var bd:BitmapData = new BitmapData(objSet.width, objSet.height, true, 0);

    var tmc:MovieClip = create.Movie(mc._parent, newMC);

    var bmc:MovieClip = create.Movie(tmc, "mc");

    bd.draw(mc);

    bmc.attachBitmap(bd, 1);

    switch (type) {

    case "h" :

    bmc._x =objSet.width

    bmc._xscale = -100;

    break;

    case "v" :

    bmc._y = objSet.height

    bmc._yscale = -100;

    break;

    case "hv" :

    bmc._x = objSet.width

    bmc._xscale = -100;

    bmc._y =objSet.height

    bmc._yscale = -100;

    break;

    case "vh" :

    bmc._x =objSet.width

    bmc._xscale = -100;

    bmc._y =objSet.height

    bmc._yscale = -100;

    break;

    default :

    }

    return tmc;

    }

    nEnterFrame=function () {

    var tmc = mirror(mc,{width:120,height:106}, "mirrorMe", "h");

    tmc._x = mc._x+119;

    tmc._y = mc._y;

    var tmc = mirror(mc,{width:120,height:106}, "mirrorMe2", "v");

    tmc._x = mc._x;

    tmc._y = mc._y+105;

    var tmc = mirror(mc,{width:120,height:106}, "mirrorMe3", "hv");

    tmc._x = mc._x+119

    tmc._y = mc._y+105;

    };

最新文章