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

Snippet information

Author:
Jonas John

License:
Public Domain

Language:
PHP

Created:
06/21/2006

Updated:
06/21/2006

Tags:
, ,


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


Found a bug? Or do you have a better solution for this?
Feel free to leave a message:

Add a comment


Leave a comment