Salve a tutti,

dovrei realizzare un MC che contiene diversi orologi che segnano diversi fusi orari di alcune città del mondo, ho un bel codice che opportunamente modificato mi restituisce le date esatte delle città; questo però solo nel caso le visualizzi una per volta in pagine diverse; infatti il problema nasce quando inserisco i MC degli orologi nella stessa scena, ootenendo come risultato una serie di orologi, alcuni sballati etc... . Sapete dari una possibile soluzione per farli convivere insieme? Ho provato a modificare i nomi di istanza e altro.
Vi posto il codice.
Grazie mille in anticipo.


#initclip
SS_clock = function () { this.init();};
SS_clock.prototype = MovieClip.prototype;
Object.registerClass("SS_clock", SS_clock);
// initialize obj
SS_clock.prototype.init = function() {
this.bounding_box._visible = 0;
this.w = this._width;
this.createEmptyMovieClip("clock", 1);
if (this.$large) {
this.clock.createEmptyMovieClip("line0", 1);
this.rectangle(this.clock.line0, 49, -2, 4, 8, this.$strokeColor);
for (var a = 1; a<12; a++) {
this.clock.line0.duplicateMovieClip("line"+a, a+1, {_rotation:a*30});
}
}
if (this.$small) {
this.clock.createEmptyMovieClip("line_b0", 100);
this.rectangle(this.clock.line_b0, 52, 0, 1, 5, this.$strokeColor);
for (var a = 0; a<60; a++) {
this.clock.line_b0.duplicateMovieClip("line_b"+a, a+(101), {_rotation:a*6});
}
}
if (this.$rounded) {
this.clock.drawCircle(0, 0, this._width/2, 2, this.$strokeColor, this.$fillColor, 100);
}
// --------------------
// lancetta dei secondi
// --------------------
this.clock.createEmptyMovieClip("secondi", 1000);
this.rectangle(this.clock.secondi, -5, 0, 1, 50, this.$strokeColor);
// --------------------
// lancetta dei minuti
// --------------------
this.clock.createEmptyMovieClip("minuti", 1001);
this.rectangle(this.clock.minuti, -5, -1.5, 3, 50, this.$strokeColor);
// ------------------
// lancetta delle ore
// ------------------
this.clock.createEmptyMovieClip("ore", 1003);
this.rectangle(this.clock.ore, -5, -2.5, 5, 35, this.$strokeColor);
// adjust size
this._width = this._height=this.w;
if (this.$_enableShadow) {
this.drawShadow(this);
}
// facciamo partire l'orologio
this.startClock(this);
this.$mainTime = setInterval(this.startClock, this.$cont == true ? 10 : 1000, this);
this.$_theInt = this.$cont == true ? 10 : 1000;
};
// ---------------------------------------------
// PUBLIC METHODS
// ---------------------------------------------
SS_clock.prototype.changeInterval = function(newInterval) {
clearInterval(this.$mainTime);
this.$mainTime = setInterval(this.startClock, newInterval, this);
this.$_theInt = newInterval;
};
SS_clock.prototype.getInterval = function() {
return this.$_theInt;
};
// show the shadows
SS_clock.prototype.drawShadow = function(obj) {
obj.clock.createEmptyMovieClip("minuti_2", 800);
obj.rectangle(this.clock.minuti_2, -5, -1.5, 3, 50, obj.$_shadowColor);
obj.clock.createEmptyMovieClip("ore_2", 700);
obj.rectangle(this.clock.ore_2, -5, -2.5, 5, 35, obj.$_shadowColor);
obj.clock.createEmptyMovieClip("secondi_2", 900);
obj.rectangle(this.clock.secondi_2, -5, 0, 1, 50, obj.$_shadowColor);
obj.clock.secondi_2._alpha = obj.clock.minuti_2._alpha=obj.clock.ore_2._alpha=o bj.$_shadowAlpha;
};
// hide shadows
SS_clock.prototype.killShadow = function() {
this.$_enableShadow = false;
unloadMovie(this.clock.secondi_2);
unloadMovie(this.clock.minuti_2);
unloadMovie(this.clock.ore_2);
};
SS_clock.prototype.start = function() {
this.$mainTime = setInterval(this.startClock, this.$cont == true ? 10 : 1000, this);
};
// start the clock
SS_clock.prototype.startClock = function(obj) {
var d = new Date();
var s = d.getSeconds();
var mm = d.getMilliseconds();
var m = d.getMinutes();
var h = d.getHours();
h = h>=12 ? h-12 : h;
var s1 = (s+(mm/1000))*6;
var m1 = (m+(s1/360))*6;
var h1 = (h+(m1/360))*30;
obj.clock.secondi._rotation = (s1)-90;
obj.clock.minuti._rotation = (m1)-90;
obj.clock.ore._rotation = (h1)-90;
if (obj.$_enableShadow) {
obj.clock.secondi_2._rotation = obj.clock.secondi._rotation;
obj.clock.minuti_2._rotation = obj.clock.minuti._rotation;
obj.clock.ore_2._rotation = obj.clock.ore._rotation;
obj.clock.secondi_2._x = obj.clock.secondi._x+2;
obj.clock.secondi_2._y = obj.clock.secondi._y+2;
obj.clock.minuti_2._x = obj.clock.minuti._x+1.5;
obj.clock.minuti_2._y = obj.clock.minuti._y+1.5;
obj.clock.ore_2._x = obj.clock.ore._x+1.5;
obj.clock.ore_2._y = obj.clock.ore._y+1.5;
}
};
SS_clock.prototype.stop = function() {
clearInterval(this.$mainTime);
};
//
// ---------------------
// PRIVATE METHODS
// ---------------------
//
SS_clock.prototype.drawCircle = function(thex, they, theradius, lineW, lineColor, fillColor, fillAlpha) {
var x, y, r, u, v;
x = thex;
y = they;
r = theradius;
u = r*0.4086;
v = r*0.7071;
if (lineW != '') {
this.lineStyle(lineW, lineColor, 100);
}
if (fillColor != undefined || fillColor != '') {
this.beginFill(fillColor, fillAlpha);
}
this.moveTo(x-r, y);
this.curveTo(x-r, y-u, x-v, y-v);
this.curveTo(x-u, y-r, x, y-r);
this.curveTo(x+u, y-r, x+v, y-v);
this.curveTo(x+r, y-u, x+r, y);
this.curveTo(x+r, y+u, x+v, y+v);
this.curveTo(x+u, y+r, x, y+r);
this.curveTo(x-u, y+r, x-v, y+v);
this.curveTo(x-r, y+u, x-r, y);
if (fillColor != undefined || fillColor != '') {
this.endFill();
}
};
SS_clock.prototype.rectangle = function(obj, x, y, h, w, rgb) {
obj.lineStyle(0, 0, 0);
obj.beginFill(rgb, 100);
obj.moveTo(x, y);
obj.lineTo(x+w, y);
obj.lineTo(x+w, y+h);
obj.lineTo(x, y+h);
obj.lineTo(x, y);
obj.endFill();
};
#endinitclip