论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > Flash AS教程
Tag:2.0,3.0菜鸟,游戏,,cs,技巧,源码,,文本,文字,函数,音乐,随机,拖拽,asp,access,xml,mc,视频教程

Flash AS绘制飘动的红灯笼

文章类别:Flash AS | 发表日期:2010-3-19 8:59:49

效果:


详细代码:

[SWF(backgroundColor=0x004890,width=550,height=400)]

var denglong:MovieClip =new MovieClip();

addChild(denglong);

denglong.x=275;

denglong.y=0;

denglong.rotation=5;

var rota:Number=0;

denglong.addEventListener(Event.ENTER_FRAME ,frame);

function frame(e) {

        var xs:Number=(0-denglong.rotation)*0.01;

        rota+=xs;

        denglong.rotation+=rota;

}

var diaoxian:Shape =new Shape();

denglong.addChild(diaoxian);

diaoxian.graphics.lineStyle(6, 0xcc6600);

diaoxian.graphics.moveTo(0,0);

diaoxian.graphics.lineTo(0,50);

function Rect():Sprite {

        var sp:Sprite =new Sprite();

        sp.graphics.beginGradientFill("linear" ,[0xffbe17,0xf8fd97,0xffbe17],[1,1,1],[0,128,255]);

        sp.graphics.drawRoundRect(-50,-10,100,20,15,13);

        var mc:Shape=new Shape();

        sp.addChild(mc);

        mc.graphics.lineStyle(1.5,0x996633,1);

        mc.graphics.drawRoundRect(-48,-9,96,18,13,12);

        return sp;

}

for (var c:int=0; c<4; c++) {

        var rect:Sprite=Rect();

        denglong.addChild(rect);

        c%2==0?[rect.scaleX=rect.scaleY=0.7,rect.y=50+c*107]:rect.y=c*90-23;

}

function Huxian(n:int):Shape {

        var hu:Shape=new Shape();

        hu.graphics.beginFill(0xffbe17,1);

        hu.graphics.moveTo(0,0);

        hu.graphics.curveTo(n,80,0,160);

        hu.graphics.curveTo(n+5,80,0,0);

        return hu;

}

var ellip:Sprite=new Sprite();

denglong.addChildAt(ellip,0);

ellip.y=158;

ellip.graphics.beginGradientFill("radial" ,[0xfea408,0xe20708],[1,1],[0,255]);

ellip.graphics.drawEllipse(-120,-85,240,170);

for (var d:int=0; d<4; d++) {

        var n:int;

        var huxian:Shape=Huxian(d%4==0?n=-80:d%4==1?n=-60:d%4==2?n=60:d%4==3?n=80:0);

        ellip.addChild(huxian);

        huxian.x=-45+d*30;

        huxian.y=-80;

}

function line():Sprite {

        var sp:Sprite =new Sprite();

        sp.graphics.lineStyle(0.5,0xffff00,1);

        sp.graphics.moveTo(0,0);

        sp.graphics.lineTo(0,60);

        return sp;

}

for (var a:int=0; a<15; a++) {

        var mc:Sprite=line();

        denglong.addChild(mc);

        mc.x=a*4-28;

        mc.y=270;

}

视频教程列表
文章教程搜索
 
Flash AS推荐教程
Flash AS热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058