• 爱情文章
  • 亲情文章
  • 友情文章
  • 生活随笔
  • 校园文章
  • 经典文章
  • 人生哲理
  • 励志文章
  • 搞笑文章
  • 心情日记
  • 英语文章
  • 范文大全
  • 作文大全
  • 新闻阅读
  • 当前位置: 山茶花美文网 > 友情文章 > 正文

    绚丽的闪字动画-Flash,AS特效:闪字组词

    时间:2018-08-10来源:山茶花美文网 本文已影响 山茶花美文网手机站

    代码如下:
    import mx.transitions.*;
    import mx.transitions.easing.*;
    var r:Number = 45;
    var p:Number = 0;
    var drag:Boolean = false;
    var num:Number = 0;
    var name_array:Array = new Array("闪", "吧", "2", "0", "0", "8", "兴", "旺", "发", "展");
    this.createEmptyMovieClip("container", this.getNextHighestDepth());
    /*旋转*/
    function start_func() {
    for (var i:Number = 0; i<=9; i++) {
      container.attachMovie("ball", "ball"+i, i);
      container["ball"+i]._x = 225+r*(Math.abs(4.5-i))*Math.cos((135-(Math.floor((i/5))*180))*Math.PI/180);
      container["ball"+i]._y = 225+r*(Math.abs(4.5-i))*Math.sin((135-(Math.floor((i/5))*180))*Math.PI/180);
      container["ball"+i].txt.text = name_array[i];
      container["ball"+i].i = i;
      container["ball"+i].onEnterFrame = function() {
       var my_color:Color = new Color(this._mc);
       my_color.setRGB(Math.random()*0xFFFFFF);
       this._x = 225+r*(Math.abs(4.5-this.i))*Math.cos(((135-(Math.floor((this.i/5))*180))+p)*Math.PI/180);
       this._y = 225+r*(Math.abs(4.5-this.i))*Math.sin(((135-(Math.floor((this.i/5))*180))+p)*Math.PI/180);
       p = p+0.5;
      };
      container["ball"+i].onPress = function() {
       var myTween:Tween = new Tween(this, "_xscale", Elastic.easeOut, 100, 200, 1, true);
       var myTween:Tween = new Tween(this, "_yscale", Elastic.easeOut, 100, 200, 1, true);
      };
      container["ball"+i].onRelease = function() {
       var myTween:Tween = new Tween(this, "_xscale", Elastic.easeOut, 200, 100, 1, true);
       var myTween:Tween = new Tween(this, "_yscale", Elastic.easeOut, 200, 100, 1, true);
      };
    }
    }
    start_func();
    /*拖动跟随*/
    var mouseListener:Object = new Object();
    mouseListener.onMouseDown = function() {
    if (container["ball"+0].hitTest(_root._xmouse, _root._ymouse)) {
      drag = true;
    }
    };
    mouseListener.onMouseMove = function() {
    if (drag) {
      num = 1;
      delete container["ball"+0].onEnterFrame;
      container["ball"+0]._x = _root._xmouse;
      container["ball"+0]._y = _root._ymouse;
      for (var i:Number = 1; i<=9; i++) {
       delete container["ball"+i].onEnterFrame;
       container["ball"+i]._x += (container["ball"+(i-1)]._x-container["ball"+i]._x)/3;
       container["ball"+i]._y += (container["ball"+(i-1)]._y-container["ball"+i]._y)/3;
      }
    }
    };
    mouseListener.onMouseUp = function() {
    drag = false;
    /*拖动后才能恢复*/
    if(num==1){
      start_func();
      num=0;
    }
    };
    Mouse.addListener(mouseListener);

    • 绚丽的闪字动画-Flash,AS特效:闪字组词 相关文章:
    • 爱情文章
    • 亲情文章
    • 友情文章
    • 随笔
    • 哲理
    • 励志
    • 范文大全