# Detect if click was on a "graphics" element?

**URL:** <https://forum.kirupa.com/t/detect-if-click-was-on-a-graphics-element/238313>\
**Category:** flash\
**Created:** [September 9, 2007, 10:08pm UTC](https://forum.kirupa.com/t/detect-if-click-was-on-a-graphics-element/238313 "2007-09-09T22:08:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Psaldorn](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@Psaldorn](https://forum.kirupa.com/u/Psaldorn)\
**Post date:** [September 9, 2007, 10:08pm UTC](https://forum.kirupa.com/t/detect-if-click-was-on-a-graphics-element/238313/1 "2007-09-09T22:08:19Z")

</div>

Evening all,  
I was wondering if it was possible to detect if the mouse was clicked on a dynamically drawn part of a symbol or the “original” hardcoded part.

I have some items that extend lines to other items and the last in the chain targets the mouse position. I have behaviour that allows start, mid and end chain objects to be dragged around, and also code that generates a new dot when the user clicks the region.

What’s happening is that the mouse is over the line extending from the previous object, and it is being counted as a click on that, not the region.

So I need a way of making the dynamic line to be not-counted-as-the object (which would require a major rewrite i think) or a way of the object knowing if it was that line that was clicked. I seem to have fixed it by adding “true” after the event listener, but then this disables the dragging code altogether ☹

Is there something obvious I have missed to get around this? I’m only a week into classes and AS3 :S

Thanks in advance 🙂

Edit: forgot to mention, I had thought of using “if distance from 0,0 greater than…” but it seems a little hacky, and if I use different sized items then they will have to know where their usable bounds are… there are lots of solutions I can think of but none seem very optimal or neat.
