Flash red moving Cube in PHP

Oct 19, 2009 Author: Developer

First of all you write the function Ming_useSWFVersion(4). This function sets the SWF version to be used in the movie. This affect the bahaviour of Action Script. Only versions 4 through 8 inclusive are supported at this time. SWFShape is an construct and creates a new shape object. This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. This is a simple SWF code made in php with ming library. When you write this code you will see red cube.

When you click on the red cube with a left click and move up, down, left or right you can see that the cube is moving in the same directions where the mouse is going.

If you want to see more PHP-Ming tutorials please look out How to Create a Flash Movie.

$s = new SWFShape();  
$s->setRightFill($s->addFill(0xff, 0, 0));  
$s->movePenTo(-25, -25);  
$s->drawLine(50, 0);  
$s->drawLine(0, 50);  
$s->drawLine(-50, 0);  
$s->drawLine(0, -50);  
$b = new SWFButton();  
$b->addAction(new SWFAction("startDrag('/test', 0);"),		
$b->addAction(new SWFAction("stopDrag();"),		
$p = new SWFSprite();  
$m = new SWFMovie();  
$m->setDimension(320, 240);  
$i = $m->add($p);  
header('Content-type: application/x-shockwave-flash');  
This is very simple example of PHP-Ming and if you have any questions, please feel free to leave a comment on the tutorial.

tags: Red moving cube

views 4861
  1. Add New Comment