
Код:
var Go:Array = [3, 5, 7];
var __x:Number = Go[1];
var __y:Number = Go[1];
//
var __q:Number = 1;
var __a:Number = 1;
//
var controll_Go:Number = 0;
///
///
var ball:MovieClip = this.createEmptyMovieClip("ball", this.getNextHighestDepth());
with (ball) {
lineStyle(0.25, 0x000000);
beginFill(0x0099CC);
moveTo(-12, -12);
lineTo(-12, -12);
lineTo(12, -12);
lineTo(12, 12);
lineTo(-12, 12);
endFill();
}
ball._x = Stage.width/2;
ball._y = Stage.height/2;
///
///
ball.onEnterFrame = function() {
if (controll_Go == 0) {
this._x -= __x;
this._y -= __y;
if (this._y>=Stage.height-(this._height/2) || this._y<=this._height/2) {
__q = -__q;
__y = Go[random(Go.length)]*__q;
}
if (this._x>=Stage.width-(this._width/2) || this._x<=this._width/2) {
__a = -__a;
__x = Go[random(Go.length)]*__a;
}
}
};
///
///
ball.onRollOut = function() {
controll_Go = 0;
this._xscale = this._yscale=100;
};
//
ball.onRollOver = function() {
controll_Go = 1;
this._xscale = this._yscale=250;
};
Годится ?
Приятной ночи