I knew it was something really stupid....

" for(i=0; i<=3; i++) " when the array length is 3....
changed to "for(i=0; i<image_url.length; i++) " and is working fine
now....

If only the behavior of accessing arrays with invalid index was
different in JS.... lol....

BTW, this image preload code is not working as expected, at least not
here with FF3....  any quick solution?


Thanks A LOT!


On Mar 25, 4:00 am, Vijaya <[email protected]> wrote:
> The error is in the following code:
>
> //when app load
> gadgets.util.registerOnLoadHandler(function(){
>     //prefetching imgs
>     preload_image_object = new Image();
>     // set image url
>
>     image_url = new Array();
>     image_url[0] = "http://naval-war.appspot.com/images/shot_hit.png";;
>     image_url[1] = "http://naval-war.appspot.com/images/shot_hit.gif";;
>
>     image_url[2] = "http://naval-war.appspot.com/images/
> shot_water.png";
>     var i = 0;
>     for(i=0; i<=3; i++)
>
>         preload_image_object.src = image_url[i];
>
> } );
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to