Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
chuck145 #1
2 images in layer, always move in sync
I have been testing some javascript to move images within a layer. (<div> tag)
I have 2 images in the layer and I change the hspace and vspace of only one,
they both move as though stuck together,
Can this behaviour be prevented.
chuck145 Guest
-
Move layer to mouse location
Has anyone used the Move layer to mouse location snippet? I cant seem to get it to work. Thanks in advance. Geo -
move objects to new layer
Is there a quick way to move objects to a new layer in situ? Can make new layer and cut and paste, but objects move. Collecting in new layer seems... -
Move objects to current layer
Is there a keyboard short cut to do this in FHMX? -
Move Object to Current Layer
Here's another question. When I select an object, then click on another layer name in the layer panel (FH MX 11, Mac), sometimes the object is moved... -
Move and resize object in layer
I have a round ball on a layer by itself and I want to make the ball smaller and then move it in relation to an object in another layer. I must be... -
Murray *ACE* #2
Re: 2 images in layer, always move in sync
I have no idea what you just said - why not post a link to the page?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
[url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
[url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
[url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
[url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
==================
"chuck145" <webforumsuser@macromedia.com> wrote in message
news:elklck$jvh$1@forums.macromedia.com...>I have been testing some javascript to move images within a layer. (<div>
>tag)
> I have 2 images in the layer and I change the hspace and vspace of only
> one,
> they both move as though stuck together,
>
> Can this behaviour be prevented.
>
>
Murray *ACE* Guest
-
chuck145 #3
Re: 2 images in layer, always move in sync
Sorry if I was not clear,
I am attaching the code - the page is not on the web
There are 2 images in the layer
When the first image is clicked, the javascript code moves the first image -
but why does the second image move ?
:smile;
<!--This page is for testing the movement of an image -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test_images</title>
<script type="text/javascript">
var imgvar
var y_jump = 6
var x_jump = 6
function checkmove()
{
imgvar = window.event.srcElement
img_y_now = imgvar.vspace
img_x_now = imgvar.hspace
imgvar.vspace = img_y_now + y_jump
imgvar.hspace = img_x_now + x_jump
}
</script>
<style type="text/css">
#Head_layer {
position:absolute;
left:71px;
top:19px;
width:732px;
height:240px;
z-index:2;
border: thin inset #660033;
}
</style>
</head>
<body>
<div id="Head_layer">
<img src="a_basketball.gif" onclick="checkmove('ball_1')"
hspace="20" vspace="30" name="ball_1" width="40" height="40" id="ball_1"/>
<img src="a_basketball.gif" hspace="200" vspace="200" name="ball_2"
width="40" height="40" id="ball_2"/>
</div>
</body>
</html>
chuck145 Guest
-
Murray *ACE* #4
Re: 2 images in layer, always move in sync
Images are inline elements - this means that they will be placed
horizontally adjacent on a line (provided the container is wide enough to
accommodate this. Your layer is 732px wide, image1 is 40px wide +20*2
spacing = 80px total width, and image2 is 40px wide + 200*2 spacing = 440px
total width.
Your javascript is directly altering the hspace assigned to image1, causing
it to occupy less total effective width. As that happens, image2 moves left
since it will always want to abut image1.
Geddit?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
[url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
[url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
[url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
[url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
==================
"chuck145" <webforumsuser@macromedia.com> wrote in message
news:elkp3q$o44$1@forums.macromedia.com...> Sorry if I was not clear,
>
> I am attaching the code - the page is not on the web
>
> There are 2 images in the layer
> When the first image is clicked, the javascript code moves the first
> image -
> but why does the second image move ?
> :smile;
>
> <!--This page is for testing the movement of an image -->
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>
> <title>test_images</title>
>
> <script type="text/javascript">
>
> var imgvar
> var y_jump = 6
> var x_jump = 6
>
>
> function checkmove()
> {
> imgvar = window.event.srcElement
>
> img_y_now = imgvar.vspace
> img_x_now = imgvar.hspace
>
>
> imgvar.vspace = img_y_now + y_jump
> imgvar.hspace = img_x_now + x_jump
> }
>
>
> </script>
>
> <style type="text/css">
>
> #Head_layer {
> position:absolute;
> left:71px;
> top:19px;
> width:732px;
> height:240px;
> z-index:2;
> border: thin inset #660033;
> }
>
> </style>
> </head>
> <body>
>
>
> <div id="Head_layer">
>
> <img src="a_basketball.gif" onclick="checkmove('ball_1')"
> hspace="20" vspace="30" name="ball_1" width="40" height="40"
> id="ball_1"/>
>
> <img src="a_basketball.gif" hspace="200" vspace="200" name="ball_2"
> width="40" height="40" id="ball_2"/>
>
> </div>
>
> </body>
> </html>
>
Murray *ACE* Guest



Reply With Quote

