If you use Flash to write Actionscript you probably use trace(); all the time and
will notice it is not present in Ming because there is no GUI to display the output.
Well you can use XPanel
and here are two examples that use it onetwo
What is so cool about Ming 0.3a ? (part I)
aside from the fact that it is open source, cross platform, and
free it also compiles much of MX Actionscript including the MX
Drawing API.
So you can make movies using Ming using standard MX Actionscript
and you can compile these movies via the command line. For Example
to draw a triangle using Flash MX you might put this code into
frame # 1
to compile it use "#php trianglemx.php" which will output
'trianglemx.swf', that is it.
so far it has compiled all the actionscript i have tried, at most
requiring a few minor tweaks.
of course you do not have to compile the movie into a swf in
advance. you can just put the php code onto the server and
dynamically output the swf each time it is called (particularly
useful if the movie draws on dynamic content such as from a MySQL
database for example). There is a lot more to Ming than just this. For more examples
and source code see the menu on the left and see the links section
for other sites with examples.
1 // a red square...
2 <?
3 // this sets the scale to a similar format as that used in flash
4 Ming_setScale(20);
5 // publish this movie for the flash 6 player
6 ming_useswfversion(6);
7 // create a movie, here we call it $movie
8 $movie=new SWFMovie();
9 // 550 by 400 is the default in flash
10 $movie->setDimension(550,400);
11 // background set to grey
12 $movie->setBackground(0xcc,0xcc,0xcc);
13 // frame rate of 12 is the default in flash
14 $movie->setRate(12);
15 // create a shape, here we call it $squareshape
16 $squareshape=new SWFShape();
17 // give it a red fill
18 $squareshape->setRightFill(255,0,0);
19 // draw that shape in a clockwise direction
20 $squareshape->drawLine(100,0); # draw the top line
21 $squareshape->drawLine(0,100); # draw the right line
22 $squareshape->drawLine(-100,0); # draw the bottom line
23 $squareshape->drawLine(0,-100); # draw the left line
24 // add $squareshape to the movie and create a reference
25 // to it called $squaresymbol so we can move it later
26 $squaresymbol=$movie->add($squareshape);
27 // now we can move $squareshape
28 $squaresymbol->moveTo(100,100);
29 // save $movie to disk, here we call it square.swf
30 $movie->save("square.swf");
31 ?>