Date : 2006/01/03
Author : HOSHI Tetsuya
Url : http://www.javac.jp

HOSSY.NET | swf server side compiler
sample sources


class Sample001 {
  function Sample001 (path) {
    var base = path.createEmptyMovieClip("base", 1);
    base._x = 100;
    base._y = 100;
    var max = 30;
    for (var i = 0; i < max; i ++) {
      var mc = base.createEmptyMovieClip("mc" + i, i);
      mc._x = 200 * Math.random() - 100;
      mc._y = 200 * Math.random() - 100;
      fillRect(mc, 5);
      mc.cnt = Math.floor(50 * Math.random());
      mc.onEnterFrame = function () {
        this._x += 0.1 * (this._parent._xmouse - this._x);
        this._y += 0.1 * (this._parent._ymouse - this._y);
        this.cnt --;
        if (this.cnt < 0) {
          this.cnt = Math.floor(50 * Math.random());
          this._x = 200 * Math.random() - 100;
          this._y = 200 * Math.random() - 100;
        }
      };
    }
  }

  function fillRect (mc, d) {
    var seed = mc.createEmptyMovieClip("seed", 1);
    seed.lineStyle(undefined);
    seed.beginFill(0x00AAAA);
    seed.moveTo(-d, -d);
    seed.lineTo(d, -d);
    seed.lineTo(d, d);
    seed.lineTo(-d, d);
    seed.lineTo(-d, -d);
    seed.endFill();
  }

  static function main () {
    var s = new Sample001(_root);
  }

}




back to list
back to launch