Ho riscritto il codice come lo avrei scritto io, ho inserito tutte le variabili, dichiarate in giro, dentro ad un Object creato apposta e ho creato due array, uno che registra ghli mc (così ce li hai tutti se ti serve ad esempio eliminarli in blocco o fare altre operazioni su quelli che hanno già finito la tween) e uno che registra tutte le tween, in modo che i nomi non le facciano accavallare e bloccare tra di loro.
C'è una sola cosa che non ho compreso, ossia come hai fatto a usare il clip "snowflakes" senza dichiararlo da nessuna parte eppure senza avere errori in compilazione. Se ho ben capito "snowflakes" è un movieclip concatenato in libreria no?! A meno che, anche letsnow non fosse in libreria.Codice PHP:package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.Regular;
public class letsnow extends MovieClip {
private var C:uint;
private var N:uint;
private var R:uint;
private var F:uint;
private var M:Array;
private var W:Array;
private var V:Object;
public function letsnow () {
C = 0;
N = 15;
R = 30
F = 0;
M = [];
W = [];
V = {};
addEventListener(Event.ENTER_FRAME, __enterframe__);
}
private function __enterframe__ (e:Event) {
if (C != N) {
C++;
} else {
F++;
C = 0;
V.current_flake = Math.round(Math.random()*2) + 1;
M.push(addChild(new snowflakes()) as MovieClip);
var mc:MovieClip = M[M.length-1];
mc.name = "flake_"+F;
mc.gotoAndStop(V.current_flake);
V.rand_depth = Math.round(Math.random()*4) + 1;
V.scale = (Math.round(100*V.rand_depth) / 5);
V.scale /= 100;
V.speed = 5 - V.rand_depth;
V.speed *= 6;
V.color_id = Math.round(Math.random()*2);
V.alpha_min = V.color_id != 2 ? 0.1 : 0.4;
V.alpha_max = V.color_id != 2 ? 0.5 : 0.7;
V.flake_alpha = Math.random()*(V.alpha_max-V.alpha_min);
V.init_x = -(R/2) + Math.round(Math.random()*stage.stageWidth);
mc.alpha = V.flake_alpha;
mc.x = V.init_x;
V.init_y = -(mc.height);
mc.y = V.init_y;
mc.scaleX = V.scale;
mc.scaleY = V.scale;
mc.addEventListener(MouseEvent.CLICK, function (e:MouseEvent) {trace(e.target.name)});
W.push(new Tween(mc, "y", Regular.easeInOut, V.init_y, (stage.stageHeight + mc.height), V.speed, true));
W[W.length-1].addEventListener(TweenEvent.MOTION_FINISH, function (e:TweenEvent) {removeChild(e.target.obj)});
}
}
}
}
[edit] niente, lascia perdere quest'ultima inutile elucubrazione, avevo dichiarato la classe come estensione di EventDispatcher invece che MovieClip

Rispondi quotando