Jump to content

getting/editing x and y of an image?


Michdd

Recommended Posts

Is it possible to grab, and set the x,y coordinates of images? I'm wondering because I want to create a map editor for a tile-based game in JS/PHP. It's just for fun, I can already do this in flash without a problem. I'm just curious if it's possible this way.

Link to comment
Share on other sites

I know I can get the coords through document.images.imagename.offsetTop and offsetLeft. But as far as I know it's not possible to edit the image's coordinates though that. Is there another way? Because I need to be able to create new images, and set their x,y

Link to comment
Share on other sites

You can get their x and y co-ordinates the way you just said, then add top and left margins to move them to the point you want.

 

Or else you can set the image with absolute positioning, which will allow you to set the specific distance from the sides of the monitor.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.