View Full Version : Threads and JavaScript
WittRaider
18.06.2001, 15:23
you heard me... I have two animations running at the same time... well at least that is where I am trying to go.
I need some kinda thread-managing system. The animations are controlled by functions which work using a timeout. Now I guess what happens is: the first thread starts and the second one doesn't come in since the first one is blocking it all...
Anyone got an idea?
-------------------------
don't work? won't work for me!
Not sure what you mean.. Do you have an example?
<font color=teal>xanth = createElement("person");
xanth.setAttribute("name", "Mike");
xanth.setAttribute("mail", "[url:8tsw8ulvoc]belgedin@earthlink.net[/url:8tsw8ulvoc]");
xanth.setAttribute("age", 16)
document.forum.appendChild(xanth);
</font id=teal>
WittRaider
18.06.2001, 15:51
kinda like on dhtml-central... when u scroll down you at some point see the menu "sliding" with the content so it always stays topmost... well I am trying to do this with layers as well... just that it's more than one at a time...
-------------------------
don't work? won't work for me!
Ahh I see..
Something like this?
http://www.dhtmlnirvana.com/mike/oop/scroll_stalk.htm
<font color=teal>xanth = createElement("person");
xanth.setAttribute("name", "Mike");
xanth.setAttribute("mail", "[url:5dsfqz9q7y]belgedin@earthlink.net[/url:5dsfqz9q7y]");
xanth.setAttribute("age", 16)
document.forum.appendChild(xanth);
</font id=teal>
WittRaider
18.06.2001, 16:02
yeah that is about it ;-)
-------------------------
don't work? won't work for me!
Cool <img src=icon_smile_big.gif border=0 align=middle> So we're all set?
<font color=teal>xanth = createElement("person");
xanth.setAttribute("name", "Mike");
xanth.setAttribute("mail", "[url:8sbuxijfmh]belgedin@earthlink.net[/url:8sbuxijfmh]");
xanth.setAttribute("age", 16)
document.forum.appendChild(xanth);
</font id=teal>
WittRaider
18.06.2001, 16:27
Thanx. I really appreciate that, but in fact it doesn't really help my exact problem... see I am working with dynLIB and expanding it. And since my actions don't have an defined end I have to do some work on threads. See if I had an appropiate x-browser event to trigger the function it would be alright but since the onscroll doesn't work I have to run this set to an relative position check over and over again...
I guess I am going to have something like a queue to have registered functions be processed one after another... this way everyone gets it's share...
Still thanx alot for the help ;-)
-------------------------
don't work? won't work for me!
aboodman
18.06.2001, 20:50
i've messed around quite a bit w/ queuing like you're talking about. you could check out my old library: ypBox... http://www.youngpup.net/components/ypBox , which can animate around 30 layers concurrently on an old p200 win 95 box concurrently. there is an example at http://www.youngpup.net/components/ypBox/ypBox_spawn.js/test_aniqueue.html .
you might also be interested in www.youngpup.net/components/ypChaser . "stalker", "chaser", whatever... this one decels to it's target, so it looks diff. might be what you want, might now... but it also queues, so you might be interested.
hope it helps. the most important thing is to use one timer. you can actually thread too, but only in IE effectively. There are some articles about it on dhtml.com. Search "multithreading".
good luck!
// aaron
// aaron@youngpup.net
// http://www.youngpup.net
Edited by - aboodman on 06/18/2001 19:52:55
WittRaider
20.06.2001, 17:00
Hey I forgot to thank you all guys... I got it to work using a global thread-management by a queue (me good english ;-)
Anyhow Thanx again! I'm leariung so much out of your examples...
just one more thing: I seem to have a hard time using the same eventhandler like window.onload = functionname; more than once... how come and how can a get around this?
Thanx Again!!!
-------------------------
don't work? won't work for me!
you should be able to use..
window.onload = Function("function1(); function()2;") //etc.
Unfortunately this won't work with events that need to have the "event" argument in NS will work with everything in IE though.
<font color=teal>xanth = document.createElement("person");
xanth.setAttribute("name", "Mike");
xanth.setAttribute("mail", "[url:h3kdqrzd8b]belgedin@earthlink.net[/url:h3kdqrzd8b]");
xanth.setAttribute("age", 16)
document.forum.appendChild(xanth);
</font id=teal>
vBulletin® v3.6.7, Copyright ©2000-2008, Jelsoft Enterprises Ltd.