What are the differences between libswf and Ming in terms of functionality and compatibility?

Libswf is a library for reading and writing SWF (Shockwave Flash) files, while Ming is a library for creating SWF files. Libswf is more focused on reading and parsing existing SWF files, while Ming is designed for creating new SWF files from scratch. In terms of compatibility, libswf may have better support for older versions of SWF files, while Ming may have more features and support for newer versions of the SWF format.

// Example code snippet using Ming to create a simple SWF file
$movie = new SWFMovie();
$movie->setDimension(320, 240);
$movie->setRate(12.0);
$movie->add(new SWFAction("stop();"));

$shape = new SWFShape();
$shape->setRightFill($shape->addFill(0xff, 0, 0));
$shape->movePenTo(0, 0);
$shape->drawLine(40, 0);
$shape->drawLine(0, 40);
$shape->drawLine(-40, 0);
$shape->drawLine(0, -40);

$movie->add($shape);

header('Content-type: application/x-shockwave-flash');
$movie->output();