forked from: flash on 2016-3-26
♥0 |
Line 37 |
Modified 2016-03-30 01:43:59 |
MIT License
archived:2017-03-20 08:35:28
ActionScript3 source code
/**
* Copyright PXshadow ( http://wonderfl.net/user/PXshadow )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/EQV1
*/
// forked from pratherj3433's flash on 2016-3-26
package {
import flash.text.TextField;
import flash.display.Shape;
import flash.display.AVM1Movie;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var tri:Shape= new Shape();
var triWidth:Number = 50;
var triHeight:Number = 50;
var point1:Shape = new Shape();
var point2:Shape = new Shape();
var point3:Shape = new Shape();
var dev:TextField = new TextField();
function drawPoint(_mc:Shape){
_mc.graphics.beginFill(0xFF794B);
_mc.graphics.drawCircle(0, 0, 10);
_mc.graphics.endFill();
addChild(_mc);
}
//create
tri.graphics.beginFill(0x009900);
tri.graphics.moveTo(0,-triHeight)
tri.graphics.lineTo(- triWidth, triHeight);
tri.graphics.lineTo(triWidth, triHeight);
tri.x = stage.stageWidth/2;
tri.y = stage.stageHeight/2;
addEventListener(Event.ENTER_FRAME, function(_:Event):void {
tri.rotation += 1;
//set points
point1.x = -Math.sin(tri.rotation * Math.PI/180) * triWidth + tri.x;
point1.y = -Math.cos(tri.rotation * Math.PI/180) * triHeight + tri.y;
dev.text = String(tri.rotation);
//90 45 45
});
}
}
}