Solved

Multiple Moving Objects

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now