Código :
var cantidad:Number = 3; var i:Number; for(i = 1; i <= cantidad; i++){ this["img" + i].iniX = this["img" + i]._x; this["img" + i].iniY = this["img" + i]._y; this["img" + i].iniW = this["img" + i]._width; this["img" + i].iniH = this["img" + i]._height; //---Arrastrar las imagenes this["img" + i].onPress = function():Void{ this.swapDepths(this._parent.getNextHighestDepth()); this.startDrag(); } //---Soltar las imagenes this["img" + i].onRelease = function():Void{ stopDrag(); //---Detectar el clip donde se ha soltado var drop:MovieClip = MovieClip(eval(this._droptarget)); var dropName:String = drop._name; //trace (drop._name); //---Si no se ha soltado encima de ningún MovieClip o no contiene el nombre "bt" if(drop == null || dropName.indexOf("bt") < 0){ this._x = this.iniX; this._y = this.iniY; error.start(); error.setVolume(100); //---Si se ha soltado encima de un MovieClip con nombre que contenga "bt" }else{ this._x = drop._x; this._y = drop._y; this._height = bt1._height; this._width = bt1._width; acierto.start(); acierto.setVolume(100); //trace(drop._y); } } } //COMPROBAR///////////////////////////////////////// comp.onRollOver = function(){ this.gotoAndPlay("up"); } comp.onRollOut = function(){ this.gotoAndPlay("down"); } comp.onRelease = function(){ if((img1._y == bt3._y)&&(img2._y == bt2._y)&&(img3._y == bt1._y)){ acierto.start(); acierto.setVolume(100); trace ("muy bueno"); } else{ img1._x = img1.iniX; img1._y = img1.iniY; img1._height = img1.iniH; img1._width = img1.iniW; error.start(); error.setVolume(100); trace("cagada"); } }
Mi problema es el siguiente. Si os fijáis al final, en el else del boton comprobar ("comp") sólo le digo a la img1 que vuelva a su origen. ¿Cómo puedo decirle que vuelvan todas sin necesidad de hacerlo una a una?
Tal como lo hice antes poniendo
Código :
this["img" + i]._x = this["img" + i].iniXno me sale.
Muchas gracias!