Publicidade
|
|
Página inicial site [RESOLVIDO] AS3
#1
Posted 08 September 2010 - 01:33 PM
Tenho uma tela inicial do site com uma animação e um botão entrar. Quero que esta tela feche e não abra mais, para dar lugar ao pagina inicial do site.
Sou iniciante actionscript 3.0.
Desde já agradeço a atenção.
Teliana
#2
Posted 08 September 2010 - 06:23 PM
Para garantir que os elementos gráficos do filme principal não estarão visíveis, você pode usar o método removeChildAt(). Ficaria assim então:
1 - No seu filme principal, aquele que tem o botão "Entrar", transforme todo o filme em um MC e atribua o nome de instância filme1_mc.
2 - Nesse arquivo, coloque o seguinte código:
//Cria um objeto URLRequest para capturar a informação de uma requisição HTTP
var req:URLRequest = new URLRequest("filme2.swf");
//Cria um objeto Loader para carregar um arquivo SWF
var loader:Loader = new Loader();
//Use o método load() para iniciar o caregamento
loader.load(req);
//Cria um ouvinte de evento para o botão entrar do filme principal
filme1_mc.entrar_mc.addEventListener(MouseEvent.MOUSE_DOWN, entraFCN);
//Cria a função que adicionará o filme a ser carregado no Stage
function entraFCN (e:MouseEvent):void {
addChild(loader);//Adicionará o filme2.swf no Stage
removeChildAt(0);//Remove o MC que estava visível, neste caso o filme1_mc
}Eu coloquei 2 exemplos na web para você ver: no primeiro eu usei o método removeChildAt() e no segundo não. Observe que no segundo exemplo os elementos gráficos do filme principal ainda estão lá, depois que o filme 2 é carregado.
#3
Posted 09 September 2010 - 12:13 PM
Com a sua explicação fiz o seguinte: a tela da animação virou um swf. Criei um outro arquivo para chamar as duas swf (a da animação e a tela principal) e depois coloquei a função que vc escreveu. Não funcionou.
Muito obrigada pela explicação e gentileza, mas não consegui.
Teliana
Pralon, on 08 September 2010 - 06:23 PM, said:
Para garantir que os elementos gráficos do filme principal não estarão visíveis, você pode usar o método removeChildAt(). Ficaria assim então:
1 - No seu filme principal, aquele que tem o botão "Entrar", transforme todo o filme em um MC e atribua o nome de instância filme1_mc.
2 - Nesse arquivo, coloque o seguinte código:
//Cria um objeto URLRequest para capturar a informação de uma requisição HTTP
var req:URLRequest = new URLRequest("filme2.swf");
//Cria um objeto Loader para carregar um arquivo SWF
var loader:Loader = new Loader();
//Use o método load() para iniciar o caregamento
loader.load(req);
//Cria um ouvinte de evento para o botão entrar do filme principal
filme1_mc.entrar_mc.addEventListener(MouseEvent.MOUSE_DOWN, entraFCN);
//Cria a função que adicionará o filme a ser carregado no Stage
function entraFCN (e:MouseEvent):void {
addChild(loader);//Adicionará o filme2.swf no Stage
removeChildAt(0);//Remove o MC que estava visível, neste caso o filme1_mc
}Eu coloquei 2 exemplos na web para você ver: no primeiro eu usei o método removeChildAt() e no segundo não. Observe que no segundo exemplo os elementos gráficos do filme principal ainda estão lá, depois que o filme 2 é carregado.
#4
Posted 09 September 2010 - 04:21 PM
Acho que indo por partes talvez possamos resolver.
#5
Posted 09 September 2010 - 09:38 PM
código:
<>
import fl.transitions.Tween;
import fl.transitions.easing.*;
var thumb_img1:Loader;
var thumb_mc1:MovieClip;
var thumb_img2:Loader;
var thumb_mc2:MovieClip;
var thumb_img3:Loader;
var thumb_mc3:MovieClip;
var thumb_img4:Loader;
var thumb_mc4:MovieClip;
var thumb_img5:Loader;
var thumb_mc5:MovieClip;
var thumb_img6:Loader;
var thumb_mc6:MovieClip;
var thumb_img7:Loader;
var thumb_mc7:MovieClip;
var thumb_img8:Loader;
var thumb_mc8:MovieClip;
var thumb_img9:Loader;
var thumb_mc9:MovieClip;
var thumb_img10:Loader;
var thumb_mc10:MovieClip;
var thumb_img11:Loader;
var thumb_mc11:MovieClip;
var thumb_img12:Loader;
var thumb_mc12:MovieClip;
thumb_img1 = new Loader();
thumb_img1.load(new URLRequest("fotocabecalho/portfolio eletronico16_cab_colorido.jpg"));
thumb_mc1 = new MovieClip();
thumb_mc1.addChild(thumb_img1);
addChild(thumb_mc1);
thumb_mc1.y = 226;
var myTween:Tween = new Tween(thumb_mc1, "x", Regular.easeOut, -100, 110, 3, true);
thumb_img2 = new Loader();
thumb_img2.load(new URLRequest("fotocabecalho/mesajantar_cab_colorido.jpg"));
thumb_mc2 = new MovieClip();
thumb_mc2.addChild(thumb_img2);
addChild(thumb_mc2);
thumb_mc2.x = 231;
var myTween2:Tween = new Tween(thumb_mc2, "y", Regular.easeOut, 114,226, 3, true);
thumb_img3 = new Loader();
thumb_img3.load(new URLRequest("fotocabecalho/panamby 14_cab_color.jpg"));
thumb_mc3 = new MovieClip();
thumb_mc3.addChild(thumb_img3);
addChild(thumb_mc3);
thumb_mc3.x = 300;
var myTween3:Tween = new Tween(thumb_mc3, "y", Regular.easeOut, -41,226, 3, true);
thumb_img4 = new Loader();
thumb_img4.load(new URLRequest("fotocabecalho/0712044347_living3_cab_color.jpg"));
thumb_mc4 = new MovieClip();
thumb_mc4.addChild(thumb_img4);
addChild(thumb_mc4);
thumb_mc4.x = 422;
var myTween4:Tween = new Tween(thumb_mc4, "y", Regular.easeOut, -87,226, 3, true);
thumb_img5 = new Loader();
thumb_img5.load(new URLRequest("fotocabecalho/panamby 19_cab_color.jpg"));
thumb_mc5 = new MovieClip();
thumb_mc5.addChild(thumb_img5);
addChild(thumb_mc5);
thumb_mc5.x = 617;
var myTween5:Tween = new Tween(thumb_mc5, "y", Regular.easeOut, -62,226, 3, true);
thumb_img6 = new Loader();
thumb_img6.load(new URLRequest("fotocabecalho/panamby 7_71.jpg"));
thumb_mc6 = new MovieClip();
thumb_mc6.addChild(thumb_img6);
addChild(thumb_mc6);
thumb_mc6.x = 717;
var myTween6:Tween = new Tween(thumb_mc6, "y", Regular.easeOut, 106,226, 3, true);
thumb_img7 = new Loader();
thumb_img7.load(new URLRequest("fotocabecalho/logotipo_114_80.jpg"));
thumb_mc7 = new MovieClip();
thumb_mc7.addChild(thumb_img7);
addChild(thumb_mc7);
thumb_mc7.y = 319;
var myTween7:Tween = new Tween(thumb_mc7, "x", Regular.easeOut, 5, 112, 3, true);
thumb_img8 = new Loader();
thumb_img8.load(new URLRequest("fotocabecalho/portfolio eletronico 24_cab_color.jpg"));
thumb_mc8 = new MovieClip();
thumb_mc8.addChild(thumb_img8);
addChild(thumb_mc8);
thumb_mc8.x = 334;
var myTween8:Tween = new Tween(thumb_mc8, "y", Regular.easeOut, 593,292, 3, true);
thumb_img9 = new Loader();
thumb_img9.load(new URLRequest("fotocabecalho/apartamento panamby_cab_color.jpg"));
thumb_mc9 = new MovieClip();
thumb_mc9.addChild(thumb_img9);
addChild(thumb_mc9);
thumb_mc9.x = 505;
var myTween9:Tween = new Tween(thumb_mc9, "y", Regular.easeOut, 751,282, 3, true);
thumb_img10 = new Loader();
thumb_img10.load(new URLRequest("fotocabecalho/sala_pinheiros_canto_cab_color.jpg"));
thumb_mc10 = new MovieClip();
thumb_mc10.addChild(thumb_img10);
addChild(thumb_mc10);
thumb_mc10.x = 588;
var myTween10:Tween = new Tween(thumb_mc10, "y", Regular.easeOut, 716,278, 3, true);
thumb_img11 = new Loader();
thumb_img11.load(new URLRequest("fotocabecalho/0712044277_living_cab_color.jpg"));
thumb_mc11 = new MovieClip();
thumb_mc11.addChild(thumb_img11);
addChild(thumb_mc11);
thumb_mc11.y = 308;
var myTween11:Tween = new Tween(thumb_mc11, "x", Regular.easeOut, 892,717, 3, true);
thumb_img12 = new Loader();
thumb_img12.load(new URLRequest("fotocabecalho/0712044312_living2_cab_color.jpg"));
thumb_mc12 = new MovieClip();
thumb_mc12.addChild(thumb_img12);
addChild(thumb_mc12);
thumb_mc12.x = 504;
var myTween12:Tween = new Tween(thumb_mc12, "y", Regular.easeOut,595,348, 3, true);
//retangulos
var shape1:Shape;// cria o retangulo que servira como preenchimento do movieclip que carrega a imagem detalhe
var shape2:Shape;
var shape3:Shape;
var shape4:Shape;
var shape5:Shape;
var shape6:Shape;
shape1 = new Shape;
shape1.graphics.beginFill(0xff9900);
shape1.graphics.drawRect(300,292,28,17);
shape1.graphics.endFill();
addChild(shape1);
shape2 = new Shape;
shape2.graphics.beginFill(0x168e13);
shape2.graphics.drawRect(383,226,33,57);
shape2.graphics.endFill();
addChild(shape2);
shape3 = new Shape;
shape3.graphics.beginFill(0xff9900);
shape3.graphics.drawRect(504,226,106,46);
shape3.graphics.endFill();
addChild(shape3);
shape4 = new Shape;
shape4.graphics.beginFill(0xe53f22);
shape4.graphics.drawRect(675,226,34,173);
shape4.graphics.endFill();
addChild(shape4);
shape5 = new Shape;
shape5.graphics.beginFill(0x168e13);
shape5.graphics.drawRect(820,226,31,73);
shape5.graphics.endFill();
addChild(shape5);
shape6 = new Shape;
shape6.graphics.beginFill(0xff9900);
shape6.graphics.drawRect(422,348,74,51);
shape6.graphics.endFill();
addChild(shape6);
var entrar_mc:MovieClip;
var carregaSWF:MovieClip;
var loaderArquivo:Loader;
entrar_mc = new menuBT();
entrar_mc.x = 430;
entrar_mc.y = 400 ;
entrar_mc.legenda_txt.text = "entrar";
entrar_mc.buttonMode = true;
entrar_mc.enabled = true;
entrar_mc.legenda_txt.mouseEnabled= false;
// listener
entrar_mc.addEventListener(MouseEvent.CLICK, abreSite);
addChild(entrar_mc);
//abre sites
function abreSite(e:MouseEvent) {
loaderArquivo = new Loader();
loaderArquivo.load(new URLRequest("carolinedegen.swf"));
carregaSWF = new MovieClip();
carregaSWF.addChild(loaderArquivo);
addChildAt(carregaSWF,1);
removeChildAt(0);
}end abre sites
<>
fim código
Pralon, on 09 September 2010 - 04:21 PM, said:
Acho que indo por partes talvez possamos resolver.
#6
Posted 09 September 2010 - 11:14 PM
Quer que o filme carolinedegen.swf, depois de carregado, esconda totalmente o filme inicial?
Quer que o filme inicial, e seus elementos, continue lá ou não?
Quais são as dimensões do filme inicial e do carolinedegen.swf?
#7
Posted 10 September 2010 - 08:20 AM
Muito obrigada pela atenção e gentileza.
Teliana
Pralon, on 09 September 2010 - 11:14 PM, said:
Quer que o filme carolinedegen.swf, depois de carregado, esconda totalmente o filme inicial?
Quer que o filme inicial, e seus elementos, continue lá ou não?
Quais são as dimensões do filme inicial e do carolinedegen.swf?
#8
Posted 10 September 2010 - 04:55 PM
Então temos os seguintes addChild:
1 - addChild(thumb_mc1), addChild(thumb_mc2), ...total = 12.
2 - addChild(shape1), ...total = 6.
3 - addChild(entrar_mc)
4 - addChildAt(carregaSWF,1)
Total de addChild = 20. As profundidades vão de ZERO a DEZENOVE.
O que você pode tentar:
1 - Substituir a função abreSite por esta:
function abreSite(e:MouseEvent) {
loaderArquivo = new Loader();
loaderArquivo.load(new URLRequest("carolinedegen.swf"));
carregaSWF = new MovieClip();
carregaSWF.addChild(loaderArquivo);
addChild(carregaSWF);
}
2 - Substituir a função abreSite por esta:
function abreSite(e:MouseEvent) {
loaderArquivo = new Loader();
loaderArquivo.load(new URLRequest("carolinedegen.swf"));
carregaSWF = new MovieClip();
carregaSWF.addChild(loaderArquivo);
removeChildAt(0);
removeChildAt(1);
removeChildAt(2);
removeChildAt(3);
removeChildAt(4);
removeChildAt(5);
removeChildAt(6);
removeChildAt(7);
removeChildAt(8);
removeChildAt(9);
removeChildAt(10);
removeChildAt(11);
removeChildAt(12);
removeChildAt(13);
removeChildAt(14);
removeChildAt(15);
removeChildAt(16);
removeChildAt(17);
removeChildAt(18);
removeChildAt(19);
addChild(carregaSWF);
}
3 - Enviar os 2 arquivos para mim: contato@marcospralon.com
#9
Posted 10 September 2010 - 09:45 PM
Fiz exatamente o que vc sugeriu, e ele apenas removeu as childs com números ímpares: 1, 3, 5, 7...vai entender....
Segui a minha idéia de fazer um outro arquivo, que chamei logo de index, fiz os dois filmes inteiros e coloquei o botão(no index). Funcionou.
Gostaria de agradecer muito, toda paciência, boa vontade, educação dispensadas. Estou muito contente pois consegui.
Muito obrigada mesmo.
Teliana
Pralon, on 10 September 2010 - 04:55 PM, said:
Então temos os seguintes addChild:
1 - addChild(thumb_mc1), addChild(thumb_mc2), ...total = 12.
2 - addChild(shape1), ...total = 6.
3 - addChild(entrar_mc)
4 - addChildAt(carregaSWF,1)
Total de addChild = 20. As profundidades vão de ZERO a DEZENOVE.
O que você pode tentar:
1 - Substituir a função abreSite por esta:
function abreSite(e:MouseEvent) {
loaderArquivo = new Loader();
loaderArquivo.load(new URLRequest("carolinedegen.swf"));
carregaSWF = new MovieClip();
carregaSWF.addChild(loaderArquivo);
addChild(carregaSWF);
}
2 - Substituir a função abreSite por esta:
function abreSite(e:MouseEvent) {
loaderArquivo = new Loader();
loaderArquivo.load(new URLRequest("carolinedegen.swf"));
carregaSWF = new MovieClip();
carregaSWF.addChild(loaderArquivo);
removeChildAt(0);
removeChildAt(1);
removeChildAt(2);
removeChildAt(3);
removeChildAt(4);
removeChildAt(5);
removeChildAt(6);
removeChildAt(7);
removeChildAt(8);
removeChildAt(9);
removeChildAt(10);
removeChildAt(11);
removeChildAt(12);
removeChildAt(13);
removeChildAt(14);
removeChildAt(15);
removeChildAt(16);
removeChildAt(17);
removeChildAt(18);
removeChildAt(19);
addChild(carregaSWF);
}
3 - Enviar os 2 arquivos para mim: contato@marcospralon.com
Share this topic:
Similar Topics
| Topic | Forum | Started By | Stats | Last Post Info | |
|---|---|---|---|---|---|
|
Psiquiatras pedem ação contra sites que incentivam anorexia
|
Notícias |
Notícias
|
|
|
|
Erramos: Cofundador do Twitter nega que site esteja à venda
|
Notícias |
Notícias
|
|
|
|
Novo blog sobre Action Script e Internet em gera. Confira.
AS3, AS2, php, coldfusion, xml, flash, flex, e muito mais. |
Avaliação |
Beraldi
|
|
|
|
Site MySpace organizará eleições primárias virtuais nos EUA
|
Notícias |
Notícias
|
|
|
|
Site Católico
será que tá legal ? |
Avaliação |
ududu
|
|
|
|
Site Chico e Pipoca
Avaliem este site infantil |
Avaliação |
Marketando
|
|
|
|
Google está perto de comprar site de compras coletivas por até US$ 6 bi
|
Notícias |
Notícias
|
|
|
|
Uerj irá criar site de vídeo universitário
|
Notícias |
Notícias
|
|
Publicidade
|
|

Help













