Ir para conteúdo

POWERED BY:

Arquivado

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

Davicamarinha

swapDepths

Recommended Posts

Ola a todos,

 

estou aprendendo a programar em AS2 (ja programo a bastante tempo em PHP e ASP). Estou montando um site so para aprender mesmo, como pratica. E estou me batendo com o seguinte problema. Eu tenho um botao, so que ele deveria ficar por cima de tudo (eu coloquei numa layer acima) so que na animação fica por tras. tentei usar o this.swapDepths(_root.getNextHighestDepth()); no codigo referente ao botao, mas nao funciona, continua por tras.

 

Segue meu AS para analise dos especialistas:

 

Stage.displayState = "fullScreen";
Stage.scaleMode = "noScale";
Stage.showMenu = false;

var mcVazio:MovieClip = _root.createEmptyMovieClip("mcVazio", this.getNextHighestDepth());

_global.mchold = null;

Stage.align = "TL";

var teste:Object = new Object();

teste.onResize = function() {
	red();
	//botao._x = (mcVazio._x/2);
	//trace(botao._y);

	/**botao._y = (mcVazio._y/2) - (mcVazio._height/2) - (botao._height/2);
	botao._x = (mcVazio._x/2) - (mcVazio._width/2) - (botao._width/2); **/
};

function red() {
	mcVazio._y = (Stage.height/2)-(mcVazio._height/2);
	mcVazio._x = (Stage.width/2)-(mcVazio._width/2);
	carregador._y = (Stage.height/2)-(carregador._height/2);
	carregador._x = (Stage.width/2)-(carregador._width/2);
	//trace(mcVazio._y);

	botao._y = mcVazio._y+mcVazio._height/2;
	botao._x = mcVazio._x-botao._width;
}


Stage.addListener(teste);


Stage.addListener(objeto);

var loading:MovieClipLoader = new MovieClipLoader();

var porcentagem:Number;

var objeto:Object = new Object();
objeto.onLoadProgress = function(target:MovieClip, bl:Number, bt:Number):Void  {
	porcentagem = Math.round((bl/bt)*100);

	trace("Carregado: "+porcentagem+"%");
	trace("Bytes Loaded: "+bl);
	trace("Bytes Total: "+bt);
	carregador.gotoAndStop(porcentagem);
	carregador.porc.text = porcentagem+"%";
};

objeto.onLoadStart = function() {
	carregador._visible = true;
	carregador._y = (Stage.height/2)-(carregador._height/2);
	carregador._x = (Stage.width/2)-(carregador._width/2);

};

objeto.onLoadInit = function(mc:MovieClip) {
	mc._y = (Stage.height/2)-(mc._height/2);
	mc._x = (Stage.width/2)-(mc._width/2);
	//trace(mc._height);
	//trace(mc._width);
	
	
	botao._y = mcVazio._y+mcVazio._height/2;
	botao._x = mcVazio._x-botao._width;
	red();
	if (porcentagem == 100) {
		//trace("Chegou a 100");
		carregador._visible = false;
	}
};
botao.onRelease = function() {
	
	mcVazio.gotoAndPlay(31);
	_global.mchold = "01.swf";
	
	//carregafilme("01.swf");
	/*mcVazio.loadMovie("5510430.jpg", this);*/
};

function carregafilme(mc) {
	loading.loadClip(mc,mcVazio);
	
}

loading.addListener(objeto);
loading.loadClip("inicio.swf",mcVazio);

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom qualquer coisa que você criar no palco como movieclips irá ficar na frente do que você criar por AS...

 

Então seu botão não vai ficar na frente de sua animação :(

 

Mas tente colocar um valor positivo alto... e você verá que não faz efeito...

 

Um tipo de solução é você instanciar sua animação e mudar o depth dela com swapDepth... talvez quem sabe resolva

 

Abraços

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.