
// main_init function

main_init = function(mc){

 tmpstr = "0," + ( $vspacing ? $linebreak + "," : "" ) + $sub_cnt;
 line_br = tmpstr.split(",");
 line_cnt = line_br.length-1;
 subs_done = true;
 mc._alpha = 0; // hide all for now, must be reset in main_effect function.

 // function to set a line

 line_set = function(line){
  line = line % line_cnt;
  line_fc = line_br[line];
  line_lc = line_br[line+1];
  for($c=0;$c<$sub_cnt;$c++) $smc[$c]._visible = $c >= line_fc && $c < line_lc;
  $mmc._y = -line * $vspacing;
 }

 // effect specific code

 lframes = max_alpha_frames + 2 * fade_frames;

}



// main_effect function

main_effect = function(mc,frame){

 sf = frame % lframes;
 if (sf == 1){
  line_set(Math.floor(frame/lframes));
 } else if (sf <= fade_frames){
  mc._alpha = sf * 100 / fade_frames;
 } else if (sf >= lframes - fade_frames){
  mc._alpha = (lframes - sf) * 100 / fade_frames;
 }
 if (frame == line_cnt * lframes) end_effect = true;

}
