Simple Ming example

This example shows how to create a simple flash animation with a red square inside (by using the Ming extension).

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();
Snippet Details




Sorry folks, comments have been deactivated for now due to the large amount of spam.

Please try to post your questions or problems on a related programming board, a suitable mailing list, a programming chat-room,
or use a QA website like stackoverflow because I'm usually too busy to answer any mails related
to my code snippets. Therefore please just mail me if you found a serious bug... Thank you!


Older comments:

None.