PHP/Utility Function/SWFMovie
A Simple Movie
<source lang="html4strict">
<?php
$mov = new SWFMovie( ); $mov->setDimension(200,20); $shape = new SWFShape( ); $shape->setLeftFill($shape->addFill(0xff, 0, 0)); $shape->movePenTo(0,0); $shape->drawLineTo(199,0); $shape->drawLineTo(0,0); $mov->add($shape); header("Content-type: application/x-shockwave-flash"); $mov->output( );
?>
</source>
Generating a Flash movie
<source lang="html4strict">
ming_UseSwfVersion(6); $movie = new SWFMovie(); $movie->setRate(20.000000); $movie->setDimension(550, 400); $movie->setBackground(0xcc,0xcc,0xcc); // Create the circle $circle = new SWFShape(); $circle->setRightFill(33,66,99); $circle->drawCircle(40); $sprite= new SWFSprite(); $sprite->add($circle); $sprite->nextFrame(); // Add the circle to the movie $displayitem = $movie->add($sprite); $displayitem->setName("circle"); $displayitem->moveTo(100,100); // Add the Actionscript that implements the dragging $movie->add(new SWFAction("
circle.onPress=function(){ this.startDrag("");}; circle.onRelease= circle.onReleaseOutside=function(){ stopDrag();};
")); // Display the movie header("Content-type: application/x-shockwave-flash"); $movie->output(1);
</source>