The setTimeout should solve your problem. can you post
your code?
I've created a small script that will do what you need.
<SCRIPT>
// Message object holds text and the position on the
screen to show them
function Message(text, left, top) {
this.text = text;
this.left = left;
this.top = top;
Quote:
}
// messageArr holds the messages
messageArr = new Array();
messageArr[messageArr.length] = new Message("text1",10,10);
messageArr[messageArr.length] = new Message
("text2",100,10);
messageArr[messageArr.length] = new Message("text3",10,10);
// showMessage displays current message
function showMessage(currMessage) {
if (currMessage >= messageArr.length) {
// no more messages, hide text and image
document.all
["messageTextDiv"].style.display = "none";
document.all["messageImage"].style.display
= "none";
} else {
// update text div
document.all["messageTextDiv"].innerHTML =
messageArr[currMessage].text;
document.all["messageTextDiv"].style.left
= messageArr[currMessage].left;
document.all["messageTextDiv"].style.top =
messageArr[currMessage].top;
// update img location
document.all["messageImage"].style.left =
messageArr[currMessage].left;
document.all["messageImage"].style.top =
messageArr[currMessage].top;
currMessage += 1;
window.setTimeout("showMessage
("+currMessage+");",3000);
}
Quote:
}
window.onload = function() {
showMessage(0);
Quote:
}
</SCRIPT>
<DIV id="messageTextDiv" style="z-index:2;
position:absolute;"></DIV>
<IMG id="messageImage" style="position:absolute;"
src="balloon.gif">
Quote:
>-----Original Message-----
>I've searched and I've searched. Is there a sleep
>function in JScript that would just make the script stop
>execution? This is what I'm trying to do.
>I have a image on the screen. Another imgae moves
>across. Once they collide, I want to do a dialog between
>the two. the dialog is only an image of a comic balloon
>with text inside.
>I want an image to appear on the screen, then after say 3
>seconds, I want the balloon popup to move over who is
>talking and show the next imgae.
>I can make the image move. That's no big deal. I can
>change the text inside the image. Actualy the text is
>above the image. The set the z-order property to higher
>number than the image.
>What I've tried.
>I have a global counter set to 0.
>When I make the image and the message visible, I check if
>the global counter is less than 100; If not, I increment
>the counter and call setTimeout(" same function()",50);
>This doesn't work. Still too fast. I even tried chaging
>the 100 to 10000. still fast.
>help
>Prince
>.