JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 13th, 2005, 01:52 PM
ezenaide's Avatar
ezenaide ezenaide is offline
custom user
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: olinda - br
Posts: 77 ezenaide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 12 h 44 m 50 sec
Reputation Power: 4
Send a message via MSN to ezenaide
FF always returns error image...

ok... here's the code

Code:
images = 10;
anims = new Array(images);
var frame = 0;
var timeout_state = null;

function imageLoad() {

	var data = new Date();

	var dia = data.getUTCDate();
	var mes = data.getUTCMonth();
	var ano = data.getUTCFullYear();
	
	var hora = data.getUTCHours();
	var minuto = data.getUTCMinutes();
	
	var dia1 = dia2(dia);
	
	var mes1 = mes2(mes);
	
	var minuto1 = minuto2(minuto);
	
	if (minuto >= 45 && minuto < 60) {
	 minuto = "15";
	} else if (minuto >= 15 && minuto < 45) {
	 hora = hora - 1;
	 minuto = "45";
	} else if (minuto >=0 && minuto < 15) {
	 hora = hora - 1;
	 minuto = "15";
	}

	var hora1 = hora2(hora);
	
	var imgSatUrl = "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora1 + "_" + minuto1 + ".png";
	document.animImage.src = imgSatUrl;

	for(var i=0; i<images; i++) {
    		anims[i] = new Image();
  	}
  	
  	if (minuto == 15) {
		anims[9].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora1 + "_15.png";
		anims[8].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-1) + "_45.png";
		anims[7].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-1) + "_15.png";
		anims[6].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-2) + "_45.png";
		anims[5].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-2) + "_15.png";
		anims[4].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-3) + "_45.png";
		anims[3].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-3) + "_15.png";
		anims[2].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-4) + "_45.png";
		anims[1].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-4) + "_15.png";
		anims[0].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-5) + "_45.png";
  	} else {
		anims[9].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora1 + "_45.png";
		anims[8].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora1 + "_15.png";
		anims[7].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-1) + "_45.png";
		anims[6].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-1) + "_15.png";
		anims[5].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-2) + "_45.png";
		anims[4].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-2) + "_15.png";
		anims[3].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-3) + "_45.png";
		anims[2].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-3) + "_15.png";
		anims[1].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-4) + "_45.png";
		anims[0].src= "satelite/" + dia1 + "_" + mes1 + "_" + ano + "_" + hora2(hora-4) + "_15.png";
  	}

}

function animator() {

  document.animImage.src = anims[frame].src;
  frame = frame + 1;
  
  document.animForm.animStep.value = frame;
  
  if (frame > (images-1) ) {
  	frame = 0;
  }
  
  timeout_state = setTimeout("animator()",1000*document.animForm.animPace.value);
  
}

function buttonCheck() {

  if(document.animForm.animButton.value == "Start" ) {
    document.animForm.animButton.value = "Stop";
    animator();
  }
  else {
    document.animForm.animButton.value = "Start";
    clearTimeout(timeout_state);
    timeout_state = null;
  }
  
}

function errorLoad() {
	
	document.animImage.src = "img/errSatelite.gif";
	
}


some variables are in an external js file...
i'm using with

Code:
<body onLoad="imageLoad()">

<img name="animImage" onError="errorLoad();" width="500px" height="200px">

<form name="animForm">
<input type="button" value="Start" name="animButton" onClick="buttonCheck()"><br><br>
<input type="text" size="4" value="1" name="animPace"><b> Segundos</b><br>
<input type="text" size="4" value="0" name="animStep" readonly="true"><b> Imagem</b>
</form>


while on IE works fine, FF always returns the errSatelite.gif, wich is the error image.

i was thinking if preloading the image array it will work...

Reply With Quote
  #2  
Old June 13th, 2005, 02:13 PM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: I have emerged from the place of spells and fairies
Posts: 97 ChiefWigs1982 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 17 h 35 m 12 sec
Reputation Power: 4
Change your image to
Code:
<img name="animImage" id="animImage" onError="errorLoad();" width="500px" height="200px">
and change the way you access the image to:
Code:
document.getElementById('animImage').src
Fix those errors and see what happens...

Reply With Quote
  #3  
Old June 13th, 2005, 02:28 PM
ezenaide's Avatar
ezenaide ezenaide is offline
custom user
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: olinda - br
Posts: 77 ezenaide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 12 h 44 m 50 sec
Reputation Power: 4
Send a message via MSN to ezenaide
nothing change

Reply With Quote
  #4  
Old June 13th, 2005, 03:41 PM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: I have emerged from the place of spells and fairies
Posts: 97 ChiefWigs1982 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 17 h 35 m 12 sec
Reputation Power: 4
Can you post a link to the page in question please?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > FF always returns error image...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT