
// main_init function

main_init = function(mc){
 subs_done = true;

 mc.cacheAsBitmap = true;

 seed = new Date();
 b = mc.getBounds(mc._parent);

 matrix = new flash.geom.Matrix(block_width,0,0,block_height,0,0);
 matrix.rotate(-block_angle*Math.PI/180);
 bitmap = new flash.display.BitmapData(50,50,1,out_effect ? 0xff000000 : 0);
 color = out_effect ? 0 : 0xff000000;

 createEmptyMovieClip('mask',7);
 mc._parent.blendMode = 'layer';
 mask.blendMode = 'alpha';

 update_mask = function(){
  with (mask){
   clear();
   beginBitmapFill(bitmap,matrix);
   moveTo(b.xMin,b.yMin);
   lineTo(b.xMax,b.yMin);
   lineTo(b.xMax,b.yMax);
   lineTo(b.xMin,b.yMax);
   endFill();
  }
 }

 update_mask();
}



// main_effect function

main_effect = function(mc,frame){
 bitmap.pixelDissolve(bitmap,bitmap.rectangle,null,seed,frame/lastsubframe*2500,color);
 update_mask();
 if (frame == lastsubframe){
  if (out_effect) mc._alpha = 0;
  mask.removeMovieClip();
  bitmap.dispose();
  end_effect = true;
 }
}



// sub_init function

sub_init = function(mc){
}



// sub_effect function

sub_effect = function(mc,frame){
}
