473,587 Members | 2,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1578


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.onlo ad = 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
4222
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. Access frequently crashes with the Win XP blue screen and the message "IRQL_NOT_LESS_THAN_EQUAL". I haven't seen the screen appear from any other...
8
1681
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 layout/style/etc. Any comments will be helpful. Thank you. /* **************************************************** C89/90 COMMENT REMOVER
2
7920
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 complete but I want to know if a match is possible so far. For instance I want to design a text box to enter a date and validate the correctness of...
14
7874
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 user in) and then redirect to the correct article. Here is the scenerio. If you are not logged into the site for certain articles you are
1
1157
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 their life easier and to automate the enforcement of validation rules, I'm enabling users to maintain an Excel file on their local machine that has...
5
1894
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
1705
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, which was acceptable when the data set was small but now it's large enough to start causing noticable delays. I've come up with a possible solution but...
6
1314
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 value(I tried || too) , $q=bar. Even though $x is properly assigned the new value, $q always ends up being bar. Abstractions aside, here's the code: ...
1
1806
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 selections. When the form is closed, I am trying to wipe out any parameters that have been set in these attributes in order to try and put the form...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8205
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.