>E' possibile creare una funzione, ho tre oggetti sullo stage ai
>quali cambio il valore della variabile angle?
Nel primo frame della timeline principale scrivi:
Poi, ai movieclip associ il seguente script, cambiando solo la parte in grassetto:codice:MovieClip.prototype.init3D = function(angle) { this.y = 100; this.speed = 2; this.radius = 100; this.xcenter = 80; this.ycenter = 80; this.zcenter = 100; this.fl = 150; this.angle = angle; }; MovieClip.prototype.rotate = function() { if(!this.sopra){ this.z = Math.sin(this.angle * Math.PI / 180) * this.radius + this.zcenter; this.scale = this.fl / (this.fl + this.z); this.x = Math.cos(this.angle * Math.PI / 180) * this.radius; this._x = this.x * this.scale + this.xcenter; this._y = this.y * this.scale + this.ycenter; this._xscale = this._yscale = this.scale * 100; this.angle += this.speed; if (this.angle > 359) { this.angle -= 360; } } }; MovieClip.prototype.hitControl = function() { if(this.hitTest(_root._xmouse, _root._ymouse, true)){ if(!this.sopra)this.sopra = true; } else { if(this.sopra)this.sopra = false; } };
>Cosa calcola la variabile fl?codice:onClipEvent (load) { this.init3D(360); } onClipEvent (enterFrame) { this.rotate(); } onClipEvent(mouseMove){ this.hitControl(); }
fl = focal length
la distanza dell'osservatore dallo schermo

Rispondi quotando