Preserved Topic: moving objects |
|
---|---|
Author | Thread |
Maniac (V) Inmate From: under the bed |
posted 03-17-2000 22:36
I am working with DHTML for the first time really, and I have some "borrowed" code for moving an image when the page loads. |
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there... From: Stockholm, Sweden |
posted 03-17-2000 22:45
Ok you have this line here...<P>eval(layerRef + '["' + which +'"]' + styleRef + '.top = start');<P>and you're sending the value 'home' for the layer to be moved, right? You could either ust stack a whole bunch of move(...) calls in your onload statement, seperated by ";", or you could set up a function that had the five move() calls in it and call *that*. OR, you could replace that line with a hard coded call to the div, like...<P>eval(layerRef + '["home"]' + styleRef + '.top = start');<P>and then add four new hard coded lines, like...<P>eval(layerRef + '["moveme"]' + styleRef + '.top = start'); |
Maniac (V) Inmate From: under the bed |
posted 03-17-2000 23:39
ARRRGGGGGGHHHHHHH! |
Bipolar (III) Inmate From: Alaska, USA |
posted 03-18-2000 00:07
WOW! A Photoshop guru AND a code expert....<P>(just trying to promote myself to lunatic)<P>Or I could pretend that I'm a mademan (i.e., the sopranos on HBO) instead of a lowly madman.....<P> <IMG SRC="http://www.ozones.com/forum/cool.gif"> |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 03-18-2000 00:33
Wouldn't a for loop work well here? |
Maniac (V) Inmate From: under the bed |
posted 03-18-2000 07:10
can you please elaborate Slime?<P>------------------ |
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there... From: Stockholm, Sweden |
posted 03-18-2000 10:28
Yah, I thought of putting all of the names in an Array, and then looping through all of them, referring to them as arrayname[x] for the divnames. That's usually how I do things myself.<P><P>------------------ |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 03-19-2000 00:12
Say here's your list of names:<P>ImageOne, ImageTwo, ImageThree, ImageFour<P>put them in an array like this:<P>var ImageNames = new Array(); |
Maniac (V) Lord Mad Scientist Sovereign of all the lands Ozone and just beyond that little green line over there... From: Stockholm, Sweden |
posted 03-19-2000 11:26
Hey, when loading text or numbers into an Array, you can take a shortcut. Instead of <P>var ImageNames = new Array(); |
Bipolar (III) Mad Scientist From: Eastbourne, UK. |
posted 03-19-2000 18:34
Hey Slime, |
Maniac (V) Inmate From: under the bed |
posted 03-19-2000 23:14
Thanks for the expalnation Slime - it was very informative; I really am starting to understand Javascript much better since coming here. It seems though, that all the images would have to move the same - is that correct? I ended up with a pretty cool effect by staggering the step/speed attributes - I'm pretty happy that I was actually able to make it work how I wanted, with a little help from Doc and friends...<P>Thanks again guys : )<P>------------------ |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 03-20-2000 17:40
Heh, thanks guys.<P>To make the images move different amounts, you can either use the variable "a" inside the moveDivision1 function call to change numbers, like...<P>for (a = 0; a < 4; a++) |
Paranoid (IV) Inmate From: Israel |
posted 03-22-2000 06:54
Hey peeps, i bet we all wanna see them finished works, so if you put em online (which is more or less what they are for) post in the showroom forum and make a link! you probably already did, i didnt check... argh. never mind ill post first and check later.<P>Never Pet a Burning Dog |