mcN = "letter";

alphaInc = (100 - alpha) / increments;
scaleInc = (100 - scale) / increments;

aLetters = new Array();

for (i = 0; i< numChar; i++)
{
  aLetters[i+0] = i;
  var letter =  this[mcN +i];
  letter._visible = false;
  letter.init = letterInit;
  letter.doEffect = effect;
  letter.number = i;
}

function letterInit()
{
  this._visible   = true;
  this.step       = 0;
  this.increments = this._parent.increments;
  this._alpha     = this._parent.alpha;
  this.alphaInc   = this._parent.alphaInc;
  this.scaleInc   = this._parent.scaleInc;

  this.scale      = this._parent.scale;

  this.angle1     = 720 * Math.random() - 360;
  this.angle2     = 720 * Math.random() - 360;

  this.angle1Inc = (0 - this.angle1) / this.increments;
  this.angle2Inc = (0 - this.angle2) / this.increments;

  // inner movie clip
  this.letter._rotation = -45;

  this._rotation = (this.angle1 + this.angle2) * .5 + 45;

  radian = 3.1416 / 180;

  angle1Rad = this.angle1 * radian;
  angle2Rad = this.angle2 * radian;

  sin45 = Math.sin(45 * radian);

  sinAngles = Math.sin(((this.angle1 + this.angle2) * .5 + 45) * radian);

  if (sinAngles == 0)
    sinAngles = 1;

  this._xscale = this.scale * (Math.cos(angle1Rad) + Math.sin(angle2Rad)) * sin45 / sinAngles;

  this._yscale = this.scale * (Math.sin(angle1Rad) + Math.cos(angle2Rad)) * sin45 / sinAngles;
}

function effect()
{
  this._alpha  += this.alphaInc;
  this.scale   += this.scaleInc;

  this.angle1  += this.angle1Inc;
  this.angle2  += this.angle2Inc;

  this._rotation = (this.angle1 + this.angle2) * .5 + 45;

  radian = 3.1416 / 180;

  angle1Rad = this.angle1 * radian;
  angle2Rad = this.angle2 * radian;

  sin45 = Math.sin(45 * radian);

  sinAngles = Math.sin(((this.angle1 + this.angle2) * .5 + 45) * radian);

  if (sinAngles == 0)
    sinAngles = 1;

  this._xscale = this.scale * (Math.cos(angle1Rad) + Math.sin(angle2Rad)) * sin45 / sinAngles;

  this._yscale = this.scale * (Math.sin(angle1Rad) + Math.cos(angle2Rad)) * sin45 / sinAngles;

  this.step += 1;

  if (this.step >= this.increments)
  {
    this._xscale = 100;
    this._yscale = 100;
    this._rotation = 45;
    this._alpha = 100;
    this.gotoAndStop("end");
  }
}

function shuffle()
{
  return Math.floor(Math.random() * 3) -1;
}

if (random == 1)
{
  aLetters.sort(shuffle);
}

if (reverse == 1)
{
  aLetters.reverse();
}