当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash AS2实例:跳动的小球动画效果

Flash动画制作
我是大导演 MTV创作速成教程
二合一按钮的制作
[DIY]这种相册你有吗?
教你一招绝的!把Flash动画转换成VCD视频
使用Flash MX的3个小技巧
Flash课件一网打尽
Flash Player 7 安全策略解析
FlashMX特效之扩散与挤压
Flash MX 2004 体验之旅
Flash使用技巧--用Flash制作拖拉式菜单
Flash使用技巧--用Flash制作转动的地球仪
Flash使用技巧--用Flash 5制作Winamp光谱柱的效果
Flash使用技巧--用Flash制作落地有声的瓶子
Flash使用技巧--用Flash 5巧做“弹出”效果菜单
Flash使用技巧--用Flash制作即指即现的广告条
用大师级软件MixFX轻松打造专业FLASH
用Flash MX快速制作沟通留言程序
用Flash制作动感效果的网页链接提示框
巧妙运用Flash MX 2004制作“拖曳配对题”
用Flash MX制作精彩的粉荷清波动画特效一例

Flash动画制作 中的 Flash AS2实例:跳动的小球动画效果


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-04   浏览: 111 ::
收藏到网摘: n/a

效果显示:


详细代码:
//AS2.0  QQ:31559783   2009.11.28
MovieClip.prototype.zl = function() {
        this.vg = 0.7;
        this.vy = 0;
        this.vx = 0;
        this.an = true;
        this.onEnterFrame = function() {
                this.vy += this.vg;
                this._y += this.vy;
                this._x += this.vx;
                if (this._x>550) {
                        this._x = 0;
                }
                if (this._x<0) {
                        this._x = 550;
                }
                if (this._y>300) {
                        this._y = 300;
                        this.vy *= -0.5;
                        this.vx *= 0.9;
                }
                if (this._y == 300 && this.an == true) {
                        ss(this._x, this._y);
                }
                if (this._y == 300 && Math.abs(this.vy) >> 0 == 0) {
                        this.an = false;
                }
        };
        this.tt = function() {
                this.vg = 0.7;
                this.vy = 0;
                this.vx -= (this._x-_root._xmouse)/30;
                this.dy = this._y-_root._ymouse;
                this.vy -= this.dy/10;
        };
};
function ss(X, Y) {
        var sj = (Math.random()*10+20) >> 0;
        for (var i = 0; i<sj; i++) {
                var mc = this.createEmptyMovieClip("huaxian_mc", this.getNextHighestDepth());
                mc._x = X;
                mc._y = Y;
                mc.lineStyle(Math.random()*3, 0, 100);
                mc.moveTo(0, 0);
                mc.lineTo(1, 0);
                mc.vx = random(20)-10;
                mc.vy = random(20)-10;
                mc.onEnterFrame = function() {
                        this._x += this.vx;
                        this._y += this.vy;
                        this.vy += 0.8;
                        this._alpha -= 2;
                        if (this._alpha<1 || this._y>=300) {
                                this.removeMovieClip();
                        }
                };
        }
}
mc.zl();
mc1.zl();
this.onMouseDown = function() {
        if (mc.an == false) {
                ss(mc._x, mc._y);
                mc.an = true;
                mc.tt();
        }
};
this.onEnterFrame = function() {
        if (random(50) == 0) {
                if (mc1.an == false) {
                        ss(mc1._x, mc1._y);
                        mc1.an = true;
                        mc1.tt();
                }
        }
};


源文件下载:跳跃的小球.rar