forked from: forked from: forked from: Alternativa3D next one
forked from forked from: forked from: Alternativa3D next one (diff: 32)
ActionScript3 source code
/**
* Copyright kozaklukasz ( http://wonderfl.net/user/kozaklukasz )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/ecFh
*/
// forked from kozaklukasz's forked from: forked from: Alternativa3D next one
package {
import flash.geom.ColorTransform;
import flash.display.*;
[SWF(width = 465, height = 465, frameRate = 20,backgroundColor=0xFFFFFF)]
public class Main extends Sprite
{
private var circle:Sprite;
private var vx:Number = 6, vy:Number = 5;
public function Main()
{
circle = new Sprite();
addChild(circle);
circle.addEventListener("click", function()
{
var ct:ColorTransform = new ColorTransform();
ct.color = 0xFF0000;
circle.transform.colorTransform = ct;
});
circle.graphics.beginFill(0x0000FF);
circle.graphics.drawCircle(0, 0, 10);
circle.x = 10;
circle.y = 10;
addEventListener("enterFrame", onUpdate);
}
private function onUpdate(e:*):void
{
if (circle.x < circle.width/2 || circle.x > stage.stageWidth - circle.width/2) vx = vx * -1;
if (circle.y < circle.height/2 || circle.y > stage.stageHeight - circle.height/2) vy = vy * -1;
circle.x += vx;
circle.y += vy;
}
}
}
