Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

lmsbxt

hitTest dentro do for

Recommended Posts

salve galera..

esse codigo ta funcionando

 

carta.onPress = function() {		this.swapDepths(getNextHighestDepth());		this.startDrag();	};	carta.onRelease = function() {		this.stopDrag();		if (this.hitTest(container)) {			status_mc.gotoAndPlay("certo");		} else {			status_mc.gotoAndPlay("errado");			this._x = 15;			this._y = 226;		}	};

mas se eu colocá-lo dentro de um loop ele nao funciona

for (i=1; i<=12; i++) {	//definicao das variaveis	var carta = this["carta"+i];	var container = this["container"+i];	//algoritimo do loop	//trace(carta);	carta.onPress = function() {		this.swapDepths(getNextHighestDepth());		this.startDrag();	};	carta.onRelease = function() {		this.stopDrag();		if (this.hitTest(container)) {			status_mc.gotoAndPlay("certo");		} else {			status_mc.gotoAndPlay("errado");			this._x = 15;			this._y = 226;		}	};}
alguém aí dá uma luz por favor...

valeew

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.