Solved

Multiple Moving Objects

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

744 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

9 Experts available now in Live!

Get 1:1 Help Now