Jump to content


Photo

Carregador


  • Faça o login para participar
1 reply to this topic

#1 Chetspop HP

Chetspop HP

    Novato no fórum

  • Usuários
  • 20 posts
  • Sexo:Não informado

Posted 01/05/2003, 16:35

Esse código abaixo é pra um carregador q eu tenho aki... só q a porcentagem fica. por exemplo: 53,341 % ... eu queria q ficasse apenas 53 %... Alguem aí sabe como? Aí vai o código do loader...

onClipEvent (load) {
	total = "_root.getBytesTotal ();";
}
onClipEvent (enterFrame) {
	baixado = _root.getBytesLoaded()+"bytes";
	restam = total-baixado+"bytes";
	porcentagem = _root.getBytesLoaded()/_root.getBytesTotal()*100;
	ComandaBarra = int(porcentagem*10);
	strporcentagem = substring(porcentagem, 1, 5)+" % ";
	with (_root.barra) {
  gotoAndStop(ComandaBarra);
	}
	if (porcentagem == 100) {
  tellTarget ("_parent") {
 	 gotoAndPlay ("Animation", 1);
  }
	}
}

Ah, e alguem sabe, o total baixado ser mostrado em Kb e os restantes tbm? Valeu à quem puder me ajudar!

#2 Foxn

Foxn

    Alone in the dark

  • Usuários
  • 1230 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP
  • Interesses:Programação, FLASH, JAVA SCRIPT, HTML, DHTML, XML, PHP e DELPHI

Posted 01/05/2003, 16:40

Use o Math.floor():

onClipEvent (load) {
total = "_root.getBytesTotal ();";
}
onClipEvent (enterFrame) {
baixado = _root.getBytesLoaded()+"bytes";
restam = total-baixado+"bytes";
porcentagem = Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100);
ComandaBarra = int(porcentagem*10);
strporcentagem = substring(porcentagem, 1, 5)+" % ";
with (_root.barra) {
gotoAndStop(ComandaBarra);
}
if (porcentagem == 100) {
tellTarget ("_parent") {
  gotoAndPlay ("Animation", 1);
}
}
}


[]'s
<?php $Nome = "Renato B. Pacheco";

	$Ocupacao = "Programador PHP";

	$Ocupacao .= "<br /> Programador ASP";

	$Ocupacao .= "<br /> Programador Action Script";

	$Localizacao =  "São Paulo - SP - Brasil" ?>




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq