Solved

Multiple Moving Objects

Posted on 1998-11-07
4
192 Views
Last Modified: 2011-10-03
How can you have two(2) objects or layers in motion concurrently?  I can make one layer (text and images) move and reposition on a screen but am unable to develop a script to allow for two(2) or more to move.
0
Comment
Question by:rcarlton
  • 3
4 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1273728
Javascript has just one "thread". So you'll have to move the layers within the same thread. So you can't really do more things simultaneously. You'll have to make them happen shortly after each other.

I don't know how you move a layer, but if you want to simulate a motion, you probably use a function which, with a setTimeOut calls itself.

If you generalize that function (make the layer and some other things depend on parameters) you could use it to move the other layer too.

For a functionality like this, look at:
http://utopia.knoware.nl/users/sybev/zt/ztnet/bedenken.htm

It is in Dutch. The thing is: if you push the "start" buttons below the text fields, each of the textfields will start displaying different words each second. For that they all use the same function that calls itself with a setTimeOut (called with different parameters).

It looks like each has its own "thread".

Hope this gives you some idea how to continue. If you want a more specific help, you'll have to post some code.




0
 
LVL 10

Accepted Solution

by:
kollegov earned 50 total points
ID: 1273729
I have a script which can moves several layers independently
The example is at my pages:
http://www.geocities.com/siliconvalley/lakes/8620/
Don't hesitste to bother me with qustions if you will need help
with it. You will find e-mail form in geoguide banner at the top
of the page.
0
 
LVL 10

Expert Comment

by:kollegov
ID: 1273730
Just curious, does my script help?
0
 
LVL 10

Expert Comment

by:kollegov
ID: 1273731
Just curious, does my script help?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Not allowed to load local recource. 4 34
Google Analytics setup 5 50
Javascript Urgent help (Need help to disable event handler) 8 42
Search Item in Table 2 19
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question