1.画个正方形

<?php
$mc = new SWFMovie();
$mc->setDimension( 200, 200 );

$s = new SWFShape();
$s->setLine( 5, 0, 0, 0 );
$s->movePenTo( 20, 20 );
$s->drawLineTo( 160, 20 );
$s->drawLineTo( 160, 160 );
$s->drawLineTo( 20, 160 );
$s->drawLineTo( 20, 20 );
$mc->add( $s );
$mc->save( 'shape.swf' );
?>

2.合并jpg图片

<?php
   $m = new SWFMovie();
  $m->setDimension(200, 200);
  $m->add(new SWFBitmap(fopen("s.jpg", "rb")));

  //header('Content-type: application/x-shockwave-flash');
  $m->save( 'shape4.swf' );
?>

3.外部加载swf

<?php
    $m = new SWFMovie();
    $m->setRate(30.000000);
    $m->setDimension(200, 200);
    $m->setBackground(0xff, 0xff, 0xff);

    $m->add(new SWFAction('
        myvar = "variable to pass to flash";
        LoadMovie("shape4.swf", "mc");
    '));

    /* -- make movie clip 'mc' that we will load flash_file_created_by_hand.swf into -- */
    $s1 = new SWFSprite();  /* (1 frames) */
    $s1->nextFrame();  /* (end of sprite frame 0) */
    $i1 = $m->add($s1);
    $i1->setName('mc');
    $m->nextFrame();  /* (end of frame 0) */

    //header('Content-type: application/x-shockwave-flash');
   // $m->output();
   $m->save("1.swf");
?>

4.合并swf,(注意这里的swf都是非压缩的,要合并压缩的swf,先要解压缩然后再压缩,参考这篇文章:php解压swf)

<?php
   $m = new SWFMovie();
  $m->setDimension(200, 200);
  $m->add(new SWFPrebuiltClip(fopen("shape4.swf", "rb")));
  $m->add(new SWFPrebuiltClip(fopen("shape.swf", "rb")));
  //header('Content-type: application/x-shockwave-flash');
  $m->save( 'ms.swf' );
?>