, 15 2014 . 11:55
+
_
, Adobe Flash
1010 , .
MovieClip - -
MyRectangle
: , . , , . , . ,
- MyRectangle
.
// . timerHandler 0.2 .
var timer:Timer = new Timer(200, 0);
timer.addEventListener (TimerEvent.TIMER, timerHandler);
timer.start ();
//
var centerX:Number = stage.stageWidth / 2;
var centerY:Number = stage.stageHeight / 2;
// ,
function timerHandler (e:Event):void {
//
var newRectangle:MyRectangle = new MyRectangle();
//
newRectangle.x = mouseX;
newRectangle.y = mouseY;
//
var dx:Number = newRectangle.x - centerX;
var dy:Number = newRectangle.y - centerY;
//
newRectangle.radius = Math.sqrt(dx*dx + dy*dy);
//
newRectangle.myAngle = Math.atan2(dy, dx);
//
newRectangle.speed = 0.06;
//
newRectangle.alpha = 0;
//
newRectangle.scaleX = Math.random() + 1.5;
newRectangle.scaleY = newRectangle.scaleX;
// ColorTransform
var colorInfo:ColorTransform = newRectangle.transform.colorTransform;
// ColorTransform
colorInfo.color = 0xffffff * Math.random();
//
newRectangle.transform.colorTransform = colorInfo;
//
addChild (newRectangle);
// ENTER_FRAME
newRectangle.addEventListener (Event.ENTER_FRAME, moveRectangle);
}
//
function moveRectangle (e:Event):void {
//
var rectangle:MovieClip = e.target as MovieClip;
//
var newX:Number = centerX + Math.cos(rectangle.myAngle) * rectangle.radius;
var newY:Number = centerY + Math.sin(rectangle.myAngle) * rectangle.radius;
//
rectangle.myAngle += rectangle.speed;
//
rectangle.x = newX;
rectangle.y = newY;
// ,
rectangle.radius -= 0.6;
//
rectangle.scaleX -= rectangle.radius * 0.0001;
rectangle.scaleY -= rectangle.radius * 0.0001;
// , 1 50
if (rectangle.alpha < 1 && rectangle.radius > 50) {
rectangle.alpha += 0.05;
}
// 50
if (rectangle.radius < 50) {
rectangle.alpha -= 0.005;
}
// 0
if (rectangle.radius < 0) {
rectangle.removeEventListener (Event.ENTER_FRAME, moveRectangle);
removeChild (rectangle);
}
}
-
- Ctrl + Enter
, - - -
, . ! .
"Adobe Flash":
1 - Adobe Flash CS6 Portable
2 - Adobe Flash.
...
32 - Adobe Flash.
33 - AS2 AS3 -
34 -
35 - Adobe Flash Professional CS6 12.0.0.481 [MULTi / ]