Jump to content
Fórum Script Brasil
  • 0

Primeira duvida


IAMDIX

Question

Ola pessoal,

estou criando meu site aqui completamente em AS3 com Flash CS3 Pro e não estou conseguindo entender porque nesse codigo a seguir os arquivos swf são carregados somente de cima para baixo

stop();
var carregarswf:Loader = new Loader();
var enderecoswf:URLRequest = new URLRequest("Home.swf");
carregarswf.load(enderecoswf);
target_mc.addChild(carregarswf); 

carregarswf.addEventListener(MouseEvent.CLICK, someImagem);
function someImagem(meuEvento:MouseEvent){
    target_mc.removeChild(carregarswf);
} 


b1.addEventListener(MouseEvent.CLICK, abre_Home);
var swf1:Loader = new Loader();
target_mc.addChild(swf1);
function abre_Home (e:MouseEvent):void{
swf1.load(new URLRequest("Home.swf"));
}
  
b2.addEventListener(MouseEvent.CLICK, abre_Galeria);
var swf2:Loader = new Loader();
target_mc.addChild(swf2);
function abre_Galeria (e:MouseEvent):void{
swf2.load(new URLRequest("Galeria.swf"));

}
b3.addEventListener(MouseEvent.CLICK, abre_Googlemap);
var swf3:Loader = new Loader();
target_mc.addChild(swf3);
function abre_Googlemap (e:MouseEvent):void{
swf3.load(new URLRequest("Googlemap.swf"));
}

b4.addEventListener(MouseEvent.CLICK, abre_Reservas);
var swf4:Loader = new Loader();
target_mc.addChild(swf4);
function abre_Reservas (e:MouseEvent):void{
swf4.load(new URLRequest("Reservas.swf"));
}

b5.addEventListener(MouseEvent.CLICK, abre_Contato);
var swf5:Loader = new Loader();
target_mc.addChild(swf5);
function abre_Contato (e:MouseEvent):void{
swf5.load(new URLRequest("Contato.swf"));
}

b6.addEventListener(MouseEvent.CLICK, abre_Apto1);
var swf6:Loader = new Loader();
target_mc.addChild(swf6);
function abre_Apto1 (e:MouseEvent):void{
swf6.load(new URLRequest("Apto1.swf"));
}

b7.addEventListener(MouseEvent.CLICK, abre_Apto2);
var swf7:Loader = new Loader();
target_mc.addChild(swf7);
function abre_Apto2 (e:MouseEvent):void{
swf7.load(new URLRequest("Apto2.swf"));
}

b8.addEventListener(MouseEvent.CLICK, abre_Apto3);
var swf8:Loader = new Loader();
target_mc.addChild(swf8);
function abre_Apto3 (e:MouseEvent):void{
swf8.load(new URLRequest("Apto3.swf"));
}

b9.addEventListener(MouseEvent.CLICK, abre_Apto4);
var swf9:Loader = new Loader();
target_mc.addChild(swf9);
function abre_Apto4 (e:MouseEvent):void{
swf9.load(new URLRequest("Apto4.swf"));
}

b10.addEventListener(MouseEvent.CLICK, abre_Apto5);
var swf10:Loader = new Loader();
target_mc.addChild(swf10);
function abre_Apto5 (e:MouseEvent):void{
swf10.load(new URLRequest("Apto5.swf"));
}

b11.addEventListener(MouseEvent.CLICK, abre_Depoimentos);
var swf11:Loader = new Loader();
target_mc.addChild(swf11);
function abre_Depoimentos (e:MouseEvent):void{
swf11.load(new URLRequest("Depoimentos.swf"));
}

b12.addEventListener(MouseEvent.CLICK, abre_Links);
var swf12:Loader = new Loader();
target_mc.addChild(swf12);
function abre_Links (e:MouseEvent):void{
swf12.load(new URLRequest("Links.swf"));
}

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Resolvido

stop();

var carregarswf:Loader = new Loader(); //utiliza o mesmo carregador pra todos os swf
target_mc.addChild(carregarswf); //adiciona o loader em um mc
abre_Home(null); //carrega primeiro a home.swf


/*********************
 * EVENTS
 *********************/ 
carregarswf.addEventListener(MouseEvent.CLICK, someImagem);
b1.addEventListener(MouseEvent.CLICK, abre_Home);
b2.addEventListener(MouseEvent.CLICK, abre_Galeria);
b3.addEventListener(MouseEvent.CLICK, abre_Googlemap);
b4.addEventListener(MouseEvent.CLICK, abre_Reservas);
b5.addEventListener(MouseEvent.CLICK, abre_Contato);


/*********************
 * FUNCTIONS
 *********************/

function someImagem(meuEvento:MouseEvent):void
{
    carregarswf.unload(); //descarrega conteudo do loader
} 

function abre_Home(e:MouseEvent):void
{
        carregarswf.load(new URLRequest("Home.swf"));
}
  
function abre_Galeria(e:MouseEvent):void
{
        carregarswf.load(new URLRequest("Galeria.swf"));
}

function abre_Googlemap(e:MouseEvent):void
{
        carregarswf.load(new URLRequest("Googlemap.swf"));
}

function abre_Reservas(e:MouseEvent):void
{
        carregarswf.load(new URLRequest("Reservas.swf"));
}

function abre_Contato(e:MouseEvent):void
{
        carregarswf.load(new URLRequest("Contato.swf"));

 }

// etc. etc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...