Re: help please!
alessandro pasotti <[email protected]> Wed, 5 Nov 2003 08:07:43 +0100
| Newsgroups | gmane.comp.web.ming.general |
|---|---|
| Message-ID | <[email protected]> |
ROTATION in AsctionScript
Hope it helps.
<?php
//#!/usr/bin/php
// create movie and set parameters
// change the following if needed for storing swf
// $_path='../../';
// I'm using ming0.3a from CVS
ming_useSWFVersion(6);
$movie=new SWFMovie();
$movie->setRate(15);
$movie->setBackground(0xee,0xee,0xff); // nice light blue
$movie->setDimension(300,150);
$movie->add(new SWFAction("
this.createEmptyMovieClip('c1', 1);
this.c1.lineStyle(1, 0x00aa00, 100);
this.c1.beginFill(0xffff00, 70);
this.c1.moveto(-20, -40);
this.c1.lineto(20, -40);
this.c1.lineto(20, 40);
this.c1.lineto(-20, 40);
this.c1.lineto(-20, -40);
this.c1.endFill();
this.c1.duplicatemovieclip('c2',0);
this.c2._x+=2;
var stepx= 3;
var stepy= 3;
this.onEnterFrame = function() {
c1._rotation += 5;
c2._rotation += 5;
if (c1._x > 300 || c1._x < 0) {
stepx = stepx > 0 ? -1 : 1;
stepx=(1+Math.random()*3)*stepx;
};
c1._x+=stepx;
if (c1._y > 150 || c1._y < 0) {
stepy = stepy > 0 ? -1 : 1;
stepy=(1+Math.random()*3)*stepy;
};
c1._y+=stepy;
};
"));
header("Content-Type:application/x-shockwave-flash");
$movie->output();
if ($argc == 0) $nome=$_path."swf/ex.swf"; else $nome=$argv[1];
//$movie->save($nome);
?>
--
Alessandro Pasotti