Simple Ming example
This example shows how to create a simple flash animation with a red square inside (by using the Ming extension).
<br/>
Other good resources: Movies with Ming, Getting Flashy With PHP, Ming functions for Flash
if (!class_exists('swfmovie')){
die('Sorry - Ming is not available on this server :-(');
}
$shape = new SWFShape();
// color (255,0,0) ==> Red
$f = $shape->addFill(255, 0, 0);
$shape->setRightFill($f);
/*
create a simple square:
25,25 ---> 25,50
^ |
| |
| !
50,25 <--- 50,50
*/
$shape->movePenTo(25,25);
$shape->drawLineTo(25,50);
$shape->drawLineTo(50,50);
$shape->drawLineTo(50,25);
$shape->drawLineTo(25,25);
// create movie object
$movie = new SWFMovie();
// flash animation size:
$movie->setDimension(320, 240);
// add the shape to the movie
$movie->add($shape);
// output the movie:
header('Content-type: application/x-shockwave-flash');
$movie->output();
Url: http://www.jonasjohn.de/snippets/php/ming-example.htm
Language: PHP | User: ShareMySnippets | Created: Oct 16, 2013