473,325 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

screen updates don't match program logic/state or order

hi!

there's a line in my Javascript program that makes a change in the
appearance of an area of the screen. it is a game program, so there are
a cascade of changes after the user makes a move. these are carefully
sequenced and timed in a loop which contains the "action" statement

document.images[k].src = offGIF[currNode];

unfortunately, the *actual* screen updating appears to be 1)
asynchronous and 2) faulty!

_asynchronou_s in that things change in the wrong order, as if each has
its own thread and they run at random.

_faulty_ in that occasionally an area that would change from, say,
picture1.gif to picture2.gif and back again (according to game logic)
lands up showing picture2.gif. even though the internal game logic has
it recorded (and i assume document.images[k].src would be correct, even
though the screen is not) as picture1.

so.

is there a way to wait or surrender control to the system until the
program statement's intent has actually been rendered to the screen?
something i can test to see if the unerlying system mechanism has caught
up with all changes to document.images?

-- rob
Jul 20 '05 #1
1 1564


robert wrote:
hi!

there's a line in my Javascript program that makes a change in the
appearance of an area of the screen. it is a game program, so there are
a cascade of changes after the user makes a move. these are carefully
sequenced and timed in a loop which contains the "action" statement

document.images[k].src = offGIF[currNode];

unfortunately, the *actual* screen updating appears to be 1)
asynchronous and 2) faulty!

_asynchronou_s in that things change in the wrong order, as if each has
its own thread and they run at random.

_faulty_ in that occasionally an area that would change from, say,
picture1.gif to picture2.gif and back again (according to game logic)
lands up showing picture2.gif. even though the internal game logic has
it recorded (and i assume document.images[k].src would be correct, even
though the screen is not) as picture1.

so.

is there a way to wait or surrender control to the system until the
program statement's intent has actually been rendered to the screen?
something i can test to see if the unerlying system mechanism has caught
up with all changes to document.images?


Loading images takes time, if you assign to
imgElement.src
then the statement just triggers the change and then returns.
If needed you can use the onload handler of the img object
imgElement.onload = function (evt) {
imgElement2.src = 'whatelse.gif';
}
imgElement.src = 'whatever.gif';

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Simon East | last post by:
We recently upgraded from Windows 98 to Windows XP (clean install), but still required to edit Access 97 databases and so have kept Access 97. We installed Word XP and Excel XP, then Access 97. ...
8
by: G Patel | last post by:
I wrote the following program to remove C89 type comments from stdin and send it to stdout (as per exercise in K&R2) and it works but I was hoping more experienced programmer would critique the...
2
by: Christian Staffe | last post by:
Hi, I would like to check for a partial match between an input string and a regular expression using the Regex class in .NET. By partial match, I mean that the input string could not yet be...
14
by: n8 | last post by:
Hi, Hi have to do the followign and have been racking my brain with various solutions that have had no so great results. I want to use the System.Net.WebClient to submit data to a form (log a...
1
by: Jeff | last post by:
I'm actually stuck! Can't believe it... so I'd appreciate some help. What I'm doing is enabling users of an ASP.NET 1.1 Web application to update a table in a SQL Server 2000 database. To make...
5
by: navicom | last post by:
How I can copy an screen area (in C# Pocket PC) in order to modify and then to restore de original content ? Thanks in advance.
4
by: T.H.N. | last post by:
I'm trying to work out a database design to make it quicker for my client program to read and display updates to the data set. Currently it reads in the entire data set again after each change,...
6
by: Jeff Gardner | last post by:
Greetings: I am attempting to get conditional output based on POSTed form data. If the posted value is either the key or value of an array, $x=key and $q=foo. elseif it is neither key nor...
1
by: mcleod1517 | last post by:
I am changing the FILTER, ORDERBY, and ORDERBYON attributes of an Access 2007 form. I have code tied to buttons on the form that resort and/or refilter the records of a datasource based on user...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.