Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #8663
| From | Dr J R Stockton <reply1147@merlyn.demon.co.uk> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Forcing Screen Updates |
| Date | 2011-11-26 17:57 +0000 |
| Organization | Home |
| Message-ID | <TjBbhmNvhS0OFwin@invalid.uk.co.demon.merlyn.invalid> (permalink) |
| References | <esstc7144g17f0vnpeodg4aiv3iid8357m@4ax.com> |
In comp.lang.javascript message <esstc7144g17f0vnpeodg4aiv3iid8357m@4ax.
com>, Thu, 24 Nov 2011 18:00:04, Gene Wirchenko <genew@ocis.net> posted:
> The text that I am using has a tictactoe game that shows the use
>of frames. What a bother to get it going, but I have.
>
> An oddity is that the winning move is sometimes shown before the
>alert about winning or losing, and sometimes, it is shown after. There
>might be a race condition going on.
The situation is perfectly clear. You have a design or coding error in
your script. But it is hard to say what, or where, it is.
If you were to read the newsgroup FAQ, or ECMA 262 edition 5.1, or my
Web site, you might well do better. Try all three.
BTW, please do not assume that the generality of readers is familiar
with all Americanisms/Canadianisms. Use the international subset of
English, if you can.
If you want to be sure that the winning move is announced after it is
shown, let the code execution come to a natural end after the winning
move is shown. Immediately before that end, put
var Good, Result ;
// Good = ...
Result = Good ? 'win' : 'lose'
setTimeout("alert('" + Result + "')", 1000)
or, better
function Show() { alert(Result) }
var Good, Result ;
// Good = ...
Result = Good ? 'win' : 'lose'
setTimeout(Show, 1000)
The 1000 is for initial test; unless redrawing your game is unreasonably
complex, 10 should do. Therefore, consider 50 or 100.
There may, and probably should, be an explicit Method for redrawing the
screen, and optionally waiting until that is finished..
--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Website <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Forcing Screen Updates Gene Wirchenko <genew@ocis.net> - 2011-11-24 18:00 -0800
Re: Forcing Screen Updates Richard Cornford <Richard@litotes.demon.co.uk> - 2011-11-25 06:26 -0800
Re: Forcing Screen Updates Tim Streater <timstreater@greenbee.net> - 2011-11-25 18:01 +0000
Re: Forcing Screen Updates Gene Wirchenko <genew@ocis.net> - 2011-11-25 12:15 -0800
Re: Forcing Screen Updates Dr J R Stockton <reply1147@merlyn.demon.co.uk> - 2011-11-26 17:57 +0000
csiph-web