<?
  $m = new SWFMovie();
  $m->setDimension(320, 240);
  $m->setBackground(0x00, 0x00, 0x00);

  $m->add(new SWFAction("

_quality = 'LOW';
frames._visible = false;
sparks = [];

  "));

  $g = new SWFGradient();
  $g->addEntry(0, 0xff, 0xff, 0xff, 0xff);
  $g->addEntry(0.1, 0xff, 0xff, 0xff, 0xff);
  $g->addEntry(0.5, 0xff, 0xff, 0xff, 0x5f);
  $g->addEntry(1.0, 0xff, 0xff, 0xff, 0);

  // gradient shape thing
  $s = new SWFShape();
  $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
  $f->scaleTo(0.03);
  $s->setRightFill($f);
  $s->movePenTo(-30, -30);
  $s->drawLine(60, 0);
  $s->drawLine(0, 60);
  $s->drawLine(-60, 0);
  $s->drawLine(0, -60);

  // need to make this a sprite so we can multColor it
  $p = new SWFSprite();
  $p->add($s);
  $p->nextFrame();

  // put the shape in here, each frame a different color
  $q = new SWFSprite();
  $q->add(new SWFAction("gotoFrame(random(7)+1); stop();"));
  $i = $q->add($p);

  $i->multColor(1.0, 1.0, 1.0);
  $q->nextFrame();
  $i->multColor(1.0, 0.5, 0.5);
  $q->nextFrame();
  $i->multColor(1.0, 0.75, 0.5);
  $q->nextFrame();
  $i->multColor(1.0, 1.0, 0.5);
  $q->nextFrame();
  $i->multColor(0.5, 1.0, 0.5);
  $q->nextFrame();
  $i->multColor(0.5, 0.5, 1.0);
  $q->nextFrame();
  $i->multColor(1.0, 0.5, 1.0);
  $q->nextFrame();

  // finally, this one contains the action code
  $p = new SWFSprite();
  $i = $p->add($q);
  $i->setName('frames');
  $p->add(new SWFAction("

dx = _root.dx/3 + random(10)-5;
dy = _root.dy/3;
x = _root._xmouse;
y = _root._ymouse;
alpha = 100;

  "));
  $p->nextFrame();

  $p->add(new SWFAction("

this._x = x;
this._y = y;
this._alpha = alpha;
x += dx;
y += dy;
dy += 3;
alpha -= 8;

  "));
  $p->nextFrame();

  $p->add(new SWFAction("prevFrame(); play();"));
  $p->nextFrame();

  $i = $m->add($p);
  $i->setName('frames');
  $m->nextFrame();

  $m->add(new SWFAction("

dx = _xmouse - lastx;
dy = _ymouse - lasty;

lastx = _xmouse;
lasty = _ymouse;

if(++num == 11)
  num = 1;

if(sparks[num])
  removeMovieClip(sparks[num]);

duplicateMovieClip('frames', 'char'+num, num);
sparks[num] = this['char'+num];

  "));

  $m->nextFrame();
  $m->add(new SWFAction("prevFrame(); play();"));

  header('Content-type: application/x-shockwave-flash');
  $m->output();
?>

click for popup

back to examples

All content Copyright (C) 2000-2001 Opaque Industries except where noted otherwise.