mi domando solo se secondo i piu' informati, una classe come questa, con la quale ho fatto alcuni esperimenti e che semra comportarsi bene, possa andare bene oppure e' concettualmente mal costruita.
si tratta sempre dell' elastic prototype riadattata a classe con 2 parametri pubblici per accelerazione e inerzia settabili con:codice:class Elastic extends MovieClip { var _acceleration:Number = 1.9; var _force_move:Number = 1.5; private var _x_movement:Number = 0; private var _y_movement:Number = 0; function Elastic() { this.Elastic_play(); } private function elastic_movement():Void { this.onEnterFrame = function() { this._x_movement = (this._x_movement + (_root._xmouse - this._x) / this._acceleration) / this._force_move; this._y_movement = (this._y_movement + (_root._ymouse - this._y) / this._acceleration) / this._force_move; this._x += this._x_movement; this._y += this._y_movement; } } function Elastic_play() { this.elastic_movement(); } function Elastic_stop() { delete this.onEnterFrame; } }
nome_istanza_palla._acceleration = 1.5;
nome_istanza_palla._force_move = 1.7;
e 2 metodi per fermare o far ripartire l' effetto ... nome_istanza_palla.Elastic_play();
e
nome_istanza_palla.Elastic_stop();
Grazie![]()


Rispondi quotando