flash on 2012-9-19
♥0 |
Line 42 |
Modified 2012-09-19 22:26:20 |
MIT License
archived:2017-03-30 22:59:37
ActionScript3 source code
/**
* Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/tz20
*/
package {
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
px = 200;
py = 0;
pa = 1.57;
stage.addEventListener(Event.ENTER_FRAME, onEnter);
}//ctor
public var px:Number = 0;
public var py:Number = 0;
public var vx:Number = 0;
public var vy:Number = 0;
public var pa:Number = 0;
public var pn:int = 0;
public function onEnter(e:Event):void
{
graphics.clear();
graphics.lineStyle(2,0);
graphics.drawCircle(px,py, 8);
vx = Math.cos(pa)*4;
vy = Math.sin(pa)*4;
pn += 1;
if (pn > 30 && pn < 40)
{ pa += 0.1; }
if (pn > 50 && pn < 60)
{ pa -= 0.1; }
px += vx;
py += vy;
if (py >= 350)
{
px = 200;
py = 0;
pa = 1.57;
vx = 0;
vy = 0;
pn = 0;
}//endif
}//onenter
}//classend
}