PHP/Ming Code

$currentframe = 0;
$mp3framect = 0;
$currentmp3 = 0;
$mp3files = array(
	"mrfancypants-1.mp3",
	);

function advanceframe() {
	
	global $movie;
	global $currentframe;
	global $mp3framect;
	
	if ( $currentframe++ == $mp3framect ) {
		loadMP3();
	}
	$movie->nextFrame();
}

function loadMP3() {
	
	global $movie;
	global $mp3framect;
	global $currentmp3;
	global $mp3files;
	
	$mp3 = fopen($mp3files[$currentmp3++],"rb");
	$mp3framect += $movie->streamMP3($mp3);
}

function forward($frames) {
	
	for ( $i = 0; $i < $frames; $i++ ) {
		advanceframe();
	}	
}

function jump($x,$n) {
	
	global $signobj;
	global $circleobj;
	$r = -15;
	$m = 32;
	for ( $i = 1; $i <= $n; $i++ ) {
		$signobj->rotateTo($r);
		$circleobj->moveTo($x,300-32*$i);
		advanceframe();
		$r+=5;
	}
	forward(4);
}

function fall($x,$n) {
	
	global $signobj;
	global $circleobj;
	$r = -5 * $n;
	for ( $i = $n; $i >= 1; $i-- ) {
		$signobj->rotateTo($r);
		$circleobj->moveTo($x,300-32*($i-1));
		advanceframe();
		$r-=5;
	}
	$signobj->rotateTo(-25);
	advanceframe();
	forward(10);	
}

// Initialize movie
Ming_setScale(20.0000000);
$movie=new SWFMovie();
$movie->setDimension(600,400);
$movie->setBackground(rand(0,0xFF),rand(0,0xFF),rand(0,0xFF));
$movie->setRate(32);

$font = new SWFFont("FreeMonoBoldOblique.ttf");

// Sign
$img="gotpants.jpg";
$sign = new SWFBitmap(fopen($img,"rb")); 
$signobj = $movie->add($sign);
$signobj->moveTo(50,50);

// Circle guy
$circle = new SWFShape();
$circle->setLine(2,0,0,0);
$circle->setRightFill(255,0,0);
$circle->drawCircle(25);
$circleobj = $movie->add($circle);
$circleobj->moveTo(500,300);

// Another circle guy
$circle2 = new SWFShape();
$circle2->setLine(2,0,0,0);
$circle2->setRightFill(0,255,0);
$circle2->drawCircle(15);
$circle2obj = $movie->add($circle2);
$circle2obj->moveTo(100,300);

// Yet another circle guy
$circle3 = new SWFShape();
$circle3->setLine(2,0,0,0);
$circle3->setRightFill(0,0,255);
$circle3->drawCircle(35);
$circle3obj = $movie->add($circle3);
$circle3obj->moveTo(50,280);

// Circle guys dancing around
for ( $i = 0; $i < 22; $i++ ) {
	$circleobj->moveTo(500-32,300-32);
	$circle2obj->moveTo(100+32,300);
	$circle3obj->moveTo(50,280-32);
	forward(2);
	$circleobj->moveTo(500-64,300);
	$circle2obj->moveTo(100+64,300);
	$circle3obj->moveTo(50,280-64);
	forward(2);
	$circleobj->moveTo(500-32,300-32);
	$circle2obj->moveTo(100+96,300);
	$circle3obj->moveTo(50,280-32);
	forward(2);
	$circleobj->moveTo(500,300);
	$circle2obj->moveTo(100+128,300);
	$circle3obj->moveTo(50,280);
	forward(4);
	$circleobj->moveTo(500,300-32);
	$circle2obj->moveTo(100+96,300);
	advanceframe();
	$circleobj->moveTo(500,300-64);
	$circle2obj->moveTo(100+64,300);
	advanceframe();
	$circleobj->moveTo(500,300-96);
	$circle2obj->moveTo(100+32,300);
	advanceframe();
	$circleobj->moveTo(500,300-64);
	$circle2obj->moveTo(100,300);
	advanceframe();
	$circleobj->moveTo(500,300-32);
	advanceframe();
	$circleobj->moveTo(500,300);
	forward(4);
}

// Sign falls partially off wall 
for ( $i = 0; $i < 30; $i+=5 ) {
	$signobj->rotateTo(-$i);
	advanceframe();
}

// Circle guy is startled
forward(4);
$text = new SWFText();
$text->setColor(0,0,0);
$text->setFont($font);
$text->setHeight(40);
$text->setSpacing(1.0);
$text->addString("?!");
$textobj = $movie->add($text);
$textobj->moveTo(525,275);
forward(20);
$movie->remove($textobj);
forward(4);

// Circle guy runs over to sign
$x = 500;
$y = 300;
$vfactor = 15;
while ( $x > 375 ) {
	$circleobj->moveTo($x,$y);
	advanceframe();
	$x-=10;
	$vfactor*=-1;
	$y+=$vfactor;
}
forward(4);

// Circle guy lifts sign
for ( $i = 25; $i > 15; $i-=5 ) {
	$signobj->rotateTo(-$i);
	$movie->nextFrame();
}
forward(20);

// Circle guy jumps to put sign back on wall, but not high enough
$x+=10;
jump($x,2);

// Circle guy and sign fall back down
fall($x,2);

// Circle guy tries again, but still high enough
jump($x,3);

// Circle guy and sign fall back down again
fall($x,3);

// Circle guy jumps to put sign back on wall, this time high enough
jump($x,4);

// Circle guy falls back down
for ( $i = 4; $i >= 1; $i-- ) {
	$circleobj->moveTo($x,300-32*($i-1));
	advanceframe();
}

// Circle guy runs back to starting location
$vfactor = 16;
while ( $x <= 500 ) {
	$circleobj->moveTo($x,$y);
	$movie->nextFrame();
	$x+=10;
	$vfactor*=-1;
	$y+=$vfactor;
}
$circleobj->moveTo(500,300);
advanceframe();

// Play out until end
for ( $i = $currentframe; $i < $mp3framect; $i++ ) {
	advanceframe();
}

//header('Content-type: application/x-shockwave-flash');
//$movie->output();
$movie->save("gotpants.swf",9);