这个动画的源程序是:
<?
// This is free demo of actionscript use with Ming 0.2a
// Copyright Armel GRIGNON 2001 blablabla - www.arpane.com/Ming_Shop/
// The main script is only 80 lines
// 2 args can be set on url : nb_stars = ?? for the number of stars and rate=?? for movie rate
// Feedback welcome !
// Creates the movie and the main sprite
$m = new SWFMovie();
$m->setRate($rate);
$m->setBackground(0, 0, 0);
$m->setDimension(640,480);
$mp = new SWFSprite();
// Adds each sprite to the main one
for($c=0; $c<$nb_stars; $c++) {
$sc=0.1+(rand()%85)/100;
$rot=rand()%10+1;
eval("$i$c=$mp"."->add($p$c);");
eval("$i$c"."->addColor(rand()%256, rand()%256, rand()%256, rand()%192);");
eval("$i$c"."->moveTo(-320+rand()%620, -240+rand()%460);");
eval("$i$c"."->scaleTo($sc, $sc);");
// When a sprite is loaded, creates the actionscript code needed to make it change
eval("$i$c"."->addAction(new SWFAction('
o=0;
sc=$sc*100;
sensX=(Math.random()*2-1)*7;
sensY=(Math.random()*2-1)*7;
function doXform$c() {
o+=$rot;
triangle$c._xscale=$sc*100*Math.cos(o*Math.PI/180);
triangle$c._rotation=o;
if (triangle$c._x>320) {sensX=-sensX;};
if (triangle$c._x<-320) {sensX=-sensX;};
triangle$c._x+=sensX;
if (triangle$c._y>320) {sensY=-sensY;};
if (triangle$c._y<-320) {sensY=-sensY;};
triangle$c._y+=sensY;
}
'), SWFACTION_ONLOAD);");
// When one sprite is entered then call the doXform function
eval("$i$c"."->addAction(new SWFAction('doXform$c();'), SWFACTION_ENTERFRAME);");
}
// Adds the main sprite to the movie
$i = $m->add($mp);
$i->setName("MainClip");
$i->moveTo(320, 240);
// Creates the actionscript code to make the main sprite rotate
$i->addAction(new SWFAction('Mouse.hide(); o=0; function DoRotation() {o+=0.5;_root.MainClip._rotation=o;}'), SWFACTION_ONLOAD);
$i->addAction(new SWFAction('DoRotation();'), SWFACTION_ENTERFRAME);
$mp->nextFrame();
// Here we are !
header('Content-type: application/x-shockwave-flash');
$m->output();
?>