Пример #1
0
int main(int argc, char** argv)
{
  SWFMovie  movie;
  SWFMovieClip dejagnuclip;
  SWFAction ac[FRAME_COUNT];
  int i;
  const char *srcdir=".";

  if ( argc>1 ) srcdir=argv[1];
  else
  {
    fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
    return 1;
  }

  Ming_init();
  movie = newSWFMovie();
  SWFMovie_setDimension(movie, 800, 600);

  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
  SWFMovie_add(movie, (SWFBlock)dejagnuclip);

  // Add frame ActionScipts to frames
  ac[0] = action_in_frame1();
  ac[1] = action_in_frame2();
  ac[2] = action_in_frame3();
  ac[3] = action_in_frame4();
  
  for(i=0; i<FRAME_COUNT; i++)
  {
    SWFMovie_add(movie, (SWFBlock)ac[i]);
    SWFMovie_nextFrame(movie); 
  }
  
  // save files
  puts("Saving " OUTPUT_FILENAME );
  SWFMovie_save(movie, OUTPUT_FILENAME);

  return 0;
}
Пример #2
0
int main(int argc, char** argv)
{
  SWFMovie  movie;
  SWFMovieClip dejagnuclip;
  SWFAction ac[FRAME_COUNT];

  SWFDisplayItem it;
  SWFMovieClip mc1;

  int i;
  const char *srcdir=".";

  if ( argc>1 ) srcdir=argv[1];
  else
  {
    fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
    return 1;
  }

  Ming_init();
  movie = newSWFMovie();
  SWFMovie_setDimension(movie, 800, 600);

  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
  SWFMovie_add(movie, (SWFBlock)dejagnuclip);

  // Add frame ActionScipts to frames
  ac[0] = action_in_frame1();
  ac[1] = action_in_frame2();
  ac[2] = action_in_frame3();
  ac[3] = action_in_frame4();
  
  for(i=0; i<FRAME_COUNT; i++)
  {
    SWFMovie_add(movie, (SWFBlock)ac[i]);
    SWFMovie_nextFrame(movie); 
  }

  SWFMovie_add(movie, (SWFBlock)newSWFAction("_level0.ar = [];"));

  // This checks that a change of target in onEnterFrame code does
  // not change the target for other code.
  mc1 = newSWFMovieClip();
  SWFMovieClip_add(mc1, (SWFBlock)newSWFAction("this.g = 'moo'; _level0.ar.push(g);"));
  SWFMovieClip_nextFrame(mc1);
  SWFMovieClip_add(mc1, (SWFBlock)newSWFAction("_level0.ar.push(g);"));
  SWFMovieClip_nextFrame(mc1);

  it = SWFMovie_add(movie, (SWFBlock)mc1);
  SWFDisplayItem_addAction(it,
    compileSWFActionCode(" _root.note('onEnterFrame');"
                         " _level0.ar.push('setTarget');"
                         " asm { push '_level0' settargetexpr }; "),
                         SWFACTION_ENTERFRAME);  
  
  SWFMovie_nextFrame(movie); 

  check_equals(movie, "ar.toString()", "'moo,setTarget,moo'");

  SWFMovie_add(movie, (SWFBlock)newSWFAction("_root.totals(); stop();"));
  SWFMovie_nextFrame(movie); 

  // save files
  puts("Saving " OUTPUT_FILENAME );
  SWFMovie_save(movie, OUTPUT_FILENAME);

  return 0;
}