[flash] uciekający przycisk
: pn gru 06, 2004 12:30 pm
jak zrobic przycisk aby w momencie najechania na niego myszką "uciekał (to znaczyprzemieszczal sie w inna czesc ekranu?
Kod: Zaznacz cały
dupa._width = 10;
dupa._height = 10;
przycisk.onRollOver = function(){
dupa.onEnterFrame = function(){
this._width += 2;
this._height += 2;
if(this._width >= 20 && this._height >= 20){
this._width = 20;
this._height = 20;
delete (this.onEnterFrame);
}
}
}
przycisk.onRollOut = function(){
dupa.onEnterFrame = function(){
this._width -= 2;
this._height -= 2;
if(this._width <= 10 && this._height <= 10){
this._width = 10;
this._height = 10;
delete (this.onEnterFrame);
}
}
}Kod: Zaznacz cały
dupa.onRollOver = function(){
speed = 0.1;
prevX = this._x;
prevY = this._y;
k = Math.round(1/speed);
X2 = random(Scene.width);
Y2 = random(Scene.height);
px = (X2-this._x)*speed;
py = (Y2-this._y)*speed;
this.onEnterFrame = function() {
this._x += px;
this._y += py;
k--;
if (k<=0) {
this._x = X2;
this._y = Y2;
delete (this.onEnterFrame);
}
};
};