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

HOSSY.NET | swf server side compiler
sample sources


class Sample002 {
  var base;
  var uniqDepth;
  var lineSeed;

  function Sample002 (path) {
    uniqDepth = 10;
    base = path.createEmptyMovieClip("base", 1);
    base._x = 100;
    base._y = 100;
    fillRect(base, 100, 0xCCCCCC);
    var ref = this;
    base.onPress = function () {
      ref.onPressHandler();
    };
    lineSeed = base.createEmptyMovieClip("base", 1);
    lineSeed.lineStyle(1,0x006666);
    lineSeed.moveTo(0, 0);
    var mc = base.createEmptyMovieClip("mc" + uniqDepth, uniqDepth);
    uniqDepth ++;
    fillRect(mc, 5, 0x00CCCC);
    mc._x = 0;
    mc._y = 0;
  }

  function onPressHandler () {
    var x = base._xmouse;
    var y = base._ymouse;
    lineSeed.lineTo(x ,y);
    var mc = base.createEmptyMovieClip("mc" + uniqDepth, uniqDepth);
    uniqDepth ++;
    fillRect(mc, 5, 0x00CCCC);
    mc._x = x;
    mc._y = y;
  }

  function fillRect (mc, d, c) {
    var seed = mc.createEmptyMovieClip("seed", 0);
    seed.lineStyle(undefined);
    seed.beginFill(c);
    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 Sample002(_root);
  }
}




back to list
back to launch