I created a shape. It will be a room.
here is the code:
room = new Sprite();
room.graphics.beginFill(0xFFFF00, 1);
room.graphics.moveTo(0, 0);
room.graphics.lineTo(0, 500);
room.graphics.lineTo(500, 500);
room.graphics.lineTo(500, 250);
room.graphics.lineTo(300, 250);
room.graphics.lineTo(300, 0);
room.graphics.endFill();
addChild(room);
and i have a red rectangle at the middle. I wanna know which wall and two point is close to this rectangle. For example: in this screenshot left wall is nearest.
Thank you
This is not an actionscript question at all. You need just an algorithm.
Simple solution: find center of the object and then use any line distance algorithm you can find to check this center point distance to all room edges.
For example this: Shortest distance between a point and a line segment