Solved

Multiple Moving Objects

Posted on 1998-11-07
4
191 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now