..:: MX Studio Fóruns ::..: Loading em uma img carregada pelo Loader - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




ATENÇÃO

Para evitar posts desnecessários e que não influam para o andamento e desenvolvimento do fórum, clique aqui e leia todas as regras.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Loading em uma img carregada pelo Loader Component Loader

#1 User is offline   ZoracKy 

  • Group: Membros
  • Posts: 109
  • Joined: 04-June 06

Posted 16 July 2006 - 05:24 PM

Tenho uma galeria de fotos bem simples, feita com o Component Loader. Queria por um loading pro carregamento das imagens com a porcentagem, mas nâo consegui fazer.

Eu dei uma vasculhada la no Help e pelo que eu vi acredito que seja usando esses dois karas Loader.bytesLoaded, Loader.bytesTotal

Eu tinha feito um campo de texto dinamico e posto assim.

instanciadocampo.text = instanciadoloader.bytesLoaded

Ele me retornou 0 sempre. O que falta ?

Segue abaixo o meu código no momento

ActionScript

//Carrega Fotos Inicial
ldr_fotoatual.contentPath = ("foto01gr.jpg");
ldr_miniatura01.contentPath = ("foto01pq.jpg");
ldr_miniatura02.contentPath = ("foto02pq.jpg");
ldr_miniatura03.contentPath = ("foto03pq.jpg");
ldr_miniatura04.contentPath = ("foto04pq.jpg");
ldr_miniatura05.contentPath = ("foto05pq.jpg");
ldr_miniatura06.contentPath = ("foto06pq.jpg");
//\Carrega Fotos Inicial
//Acao de Botao Para as Fotos Pequenas
ldr_miniatura01.onPress = function () {
       ldr_fotoatual.contentPath = ("foto01gr.jpg");
}
ldr_miniatura02.onPress = function () {
       ldr_fotoatual.contentPath = ("foto02gr.jpg");
}
ldr_miniatura03.onPress = function () {
       ldr_fotoatual.contentPath = ("foto03gr.jpg");
}
ldr_miniatura03.onPress = function () {
       ldr_fotoatual.contentPath = ("foto03gr.jpg");
}
ldr_miniatura04.onPress = function () {
       ldr_fotoatual.contentPath = ("foto04gr.jpg");
}
ldr_miniatura05.onPress = function () {
       ldr_fotoatual.contentPath = ("foto05gr.jpg");
}
ldr_miniatura06.onPress = function () {
       ldr_fotoatual.contentPath = ("foto06gr.jpg");
}
//\Acao de Botao Para as Fotos Pequenas

0

#2 User is offline   Natan 

  • Group: Moderador Global
  • Posts: 7350
  • Joined: 28-February 04

Posted 16 July 2006 - 06:43 PM

Coloca isso:

ActionScript
var total:Number = loader.getBytesTotal/1024;
var carregado:Number = loader.getBytesLoaded/1024;
loader.onEnterFrame = function() {
      porcentagem.text = Math.round((total/carregado)*100)+"%";
      if (porcentagem.text == 100) {
            delete loader.onEnterFrame;
      }


Lembrando que loader é a instancia do seu Loader.

Qualquer coisa é só falar.

Falow
0

#3 User is offline   ZoracKy 

  • Group: Membros
  • Posts: 109
  • Joined: 04-June 06

Posted 16 July 2006 - 09:41 PM

Vlw pela ajuda Natan, só que eu ainda não consegui.
o código ficou assim

ActionScript

var total:Number = ldr_fotoatual.getBytesTotal/1024;
var carregado:Number = ldr_fotoatual.getBytesLoaded/1024;
ldr_fotoatual.onEnterFrame = function() {
       porcentagem.text = Math.round((total/carregado)*100)+"%";
       if (porcentagem.text == 100) {
             delete ldr_fotoatual.onEnterFrame;
       }
}



//Carrega Fotos Inicial
ldr_fotoatual.contentPath = ("foto01gr.jpg");
ldr_miniatura01.contentPath = ("foto01pq.jpg");
ldr_miniatura02.contentPath = ("foto02pq.jpg");
ldr_miniatura03.contentPath = ("foto03pq.jpg");
ldr_miniatura04.contentPath = ("foto04pq.jpg");
ldr_miniatura05.contentPath = ("foto05pq.jpg");
ldr_miniatura06.contentPath = ("foto06pq.jpg");
//\Carrega Fotos Inicial
//Acao de Botao Para as Fotos Pequenas
ldr_miniatura01.onPress = function () {
       ldr_fotoatual.contentPath = ("foto01gr.jpg");
}
ldr_miniatura02.onPress = function () {
       ldr_fotoatual.contentPath = ("foto02gr.jpg");
}
ldr_miniatura03.onPress = function () {
       ldr_fotoatual.contentPath = ("foto03gr.jpg");
}
ldr_miniatura03.onPress = function () {
       ldr_fotoatual.contentPath = ("foto03gr.jpg");
}
ldr_miniatura04.onPress = function () {
       ldr_fotoatual.contentPath = ("foto04gr.jpg");
}
ldr_miniatura05.onPress = function () {
       ldr_fotoatual.contentPath = ("foto05gr.jpg");
}
ldr_miniatura06.onPress = function () {
       ldr_fotoatual.contentPath = ("foto06gr.jpg");
}
//\Acao de Botao Para as Fotos Pequenas


E nao funcionou, depois eu mandei o porcentagem me retornar o valor de total, e ele me retornou NAN. ?¿?¿?¿
Vlw

0

#4 User is offline   Natan 

  • Group: Moderador Global
  • Posts: 7350
  • Joined: 28-February 04

Posted 17 July 2006 - 11:36 AM

Vc já leu isso:

http://livedocs.macromedia.com/flash/8/mai...52.html#3150404

Qualquer coisa é só falar.

Falow
0

#5 User is offline   ZoracKy 

  • Group: Membros
  • Posts: 109
  • Joined: 04-June 06

Posted 18 July 2006 - 12:09 AM

thumbup.gif AeeeeeAeeeeee Vlw Natan \o/ , depois que eu li essa documentação eu consegui fazer o meu funcionar, o código ficou assim

ActionScript

var loadListener:Object = new Object();
loadListener.progress = function(eventObj) {
       var total:Number = ldr_fotoatual.bytesTotal*1024;
       var carregado:Number = ldr_fotoatual.bytesLoaded*1024;
       pct.text = Math.round((carregado/total)*100)+"%";
};
ldr_fotoatual.addEventListener("progress", loadListener);

//Carrega Fotos Inicial
ldr_fotoatual.contentPath = ("foto01gr.jpg");
ldr_miniatura01.contentPath = ("foto01pq.jpg");
ldr_miniatura02.contentPath = ("foto02pq.jpg");
ldr_miniatura03.contentPath = ("foto03pq.jpg");
ldr_miniatura04.contentPath = ("foto04pq.jpg");
ldr_miniatura05.contentPath = ("foto05pq.jpg");
ldr_miniatura06.contentPath = ("foto06pq.jpg");
//\Carrega Fotos Inicial
//Acao de Botao Para as Fotos Pequenas
ldr_miniatura01.onPress = function () {
       ldr_fotoatual.contentPath = ("foto01gr.jpg");
}
ldr_miniatura02.onPress = function () {
       ldr_fotoatual.contentPath = ("foto02gr.jpg");
}
ldr_miniatura03.onPress = function () {
       ldr_fotoatual.contentPath = ("foto03gr.jpg");
}
ldr_miniatura03.onPress = function () {
       ldr_fotoatual.contentPath = ("foto03gr.jpg");
}
ldr_miniatura04.onPress = function () {
       ldr_fotoatual.contentPath = ("foto04gr.jpg");
}
ldr_miniatura05.onPress = function () {
       ldr_fotoatual.contentPath = ("foto05gr.jpg");
}
ldr_miniatura06.onPress = function () {
       ldr_fotoatual.contentPath = ("foto06gr.jpg");
}
//\Acao de Botao Para as Fotos Pequenas


Agora só queria tirar uma dúvida, se não for pedir muito.
Pra todo esquema desses de Loading, precisa de um Listener.progress??
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


Similar Topics Collapse

  Topic Forum Started By Stats Last Post Info
New Replies Telefônica credita pane na telefonia a falha humana Notícias Notícias 
  • 0 Replies
  • 145 Views
New Replies Receita medieval no cardápio da AmBev
Uma nova Bohemia
Publicidade e Propaganda Murilo 
  • 0 Replies
  • 2805 Views
New Replies criar uma taxinha para mural
aquela que pregam recador?
Fireworks yan0202 
  • 8 Replies
  • 7410 Views
New Replies Cdonts
Componente para envio de E-mail.
Repositório de Códigos MVolpi 
  • 3 Replies
  • 5453 Views
New Replies Países brigam pelo controle da internet
IDG Now! - Internet
Notícias TiTi Celestino 
  • 0 Replies
  • 243 Views
New Replies Impressão de fotos de uma pasta do CD
Preciso imprimir fotos d uma pasta no CD
Director robertcbrasil 
  • 1 Reply
  • 1084 Views
New Replies Como Gravar Uma Faixa Interativa
me ajudaaaaaaaaaaaaa
Dúvidas Gerais giovanni ramalho 
  • 0 Replies
  • 615 Views
New Replies Upload para o MySql e
Mostrando umagem na pagina
PHP babu 
  • 1 Reply
  • 840 Views

Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)