// main_init function

main_init = function(mc){
 sub_delay = lastsubframe;
 io = new Object();
 dmax = 0;
}


// main_effect function

main_effect = function(mc,frame){
 if (frame > $sub_cnt * sub_delay ){
  end_effect = true;
  for(i=0;i<50;i++) mc["r"+i].removeMovieClip();
 }  
}

// sub_init function

sub_init = function(mc){
 dx = mc._x-light_x;
 dy = mc._y+light_y;
 mc.a = Math.atan2(dy,dx);
 mc.d = Math.sqrt(dx*dx+dy*dy);
 dmax = Math.max(dmax,mc.d);
}

// sub_effect function

sub_effect = function(mc,frame){
 d = mc.d / dmax; 
 for(i=0;i<50;i++){
  io._x = mc.__x + Math.cos(mc.a) * i * d ;
  io._y = mc.__y + Math.sin(mc.a) * i * d ;
  io._alpha = light_force * (25 - i / 2);
  io._xscale = io._yscale = 100 + (max_scale - 100) * i/50;
  mc.duplicateMovieClip("r"+i,$sub_cnt*10+i,io);
  clr = new Color($mmc["r"+i]);
  clr.setRGB(light_color);
 }  
 mc.done=true;
}
