local function screenTouch( event )

So you want the touch event to fire if the touch is not on green rect?

local eventX, eventY = event.x, event.y

 if ( event.phase == "began" ) then ... elseif ( event.phase == "moved" ) then line = display.newLine( event.xStart, event.yStart, eventX, eventY )

The Main Problem is the start phase and 
line = display.newLine( event.xStart, event.yStart, eventX, eventY )

I had 2 ideas regarding this: 

  1. If the touch starts in the greenbox the touch event can be cancelled. 
    I could make that with adding an event listener to the greenbox, but that caused also Problems. Because adding an event listene to greenbox caused trouble in the other touch eventlistenr “the entire screen”. When I for example started the event phase outside the Green box and during the “event phase move” I hovered the greenbox the "line = display.newLine ( event.xStart, event.yStart, eventX, eventY) " eventX, eventY stopped to update. That looked like a bug. That problem is why I cannot put an eventlister to the Green box.

Of course I add and remove everytime eventlistner during the touchpahse but that seems to be not clever and will slow down the Performance … I belive that there is a simpler solution for this… puting anything to the greenbox to make it Kind of not tocuhable  … touchenable  or simehting like this. did not work : /
 

The Option i like would Prefer… 
line = display.newLine ( event.xStart, event.yStart,
2. If the event starts in the Green box the event should instead of being cancelled the  event.xStart, event.yStart  should be placed around the greenbox. I do not know how to do it.  then there would not be a cancelled Status … event.xStart, event.yStart should work like objects which are pushen to the outside…   

I open minded for any other possible solutions here. 
To influence the “Phase began”  esspecially  the event.xStart, event.yStart  of the line … if this issues is solved I can adapt this solution to the other Parts of my game…

Thanks in Advance!   
I’ve updated the Img. Hope that is now clearer

not 
 

in phase == “began” why not simply store the event.xStart, event.yStart in 2 variables and use that?

Thanks!
Sound like a Great idea… I do not know much about store … : / Do you mean just making a local values  with the positions of rects? 
event.xStart - should include = display.contentWidth except this part [bounds.xMin - bounds.xMax] - should be not touchable or if the event should startoutside the box

event.yStart - should include = display.contentHeight except this part [bounds.yMin - bounds.yMax] - should be not touchable or if the event should startoutside the box

Can we not just make it this rect is not touchable … ? or just we have the breakground which is touchable and this area of the rect above the Background will make it not touchable … Kind of a Mask… tried that as well but did not work … 

[Forgive me: I have only skimmed this thread…]

It looks like you are mistaking the use of touch events for the action required by the touch in a particular location.

To explain…

If you want to respond to touches all over the screen but only have a (for example) line drawn if the touch begins outside of a given area, then you still need to handle a touch anywhere on the screen but begin one of two different events, depending on where the touch starts.

So, in your case (given the diagram in your last post) you would have a touch handler which takes the touch focus and simply doesn’t do anything; Eventually releasing when the  ended phase occurs.

In your second case, you would have a touch handler which takes the touch focus and starts (for example) drawing a line, until the ended phase occurs.

In the diagram above I would have had the first touch handler attached to the green rectangle and the second touch handler (as in the two sentences above) attached to the grey rectangle. Assuming the green rectangle is above the grey one, you will have an area which does not let lines get drawn, even if the touch starts inside and moves outside.

I hope that helps. (I’m pressed for time!)

something like

local eventStart = {} eventStart.x = event.xStart eventStart.y = event.yStart

you can then check if those fall into the green rect and if so you could offset them to start outside the green rect

if eventStart.x \> bounds.xMin and eventStart.x&nbsp;\< bounds.xMax and eventStart.y \> bounds.yMin and eventStart.y &nbsp;\<&nbsp;bounds.yMax&nbsp;then&nbsp; --start point is in green rect else&nbsp; --good start point end

First of all thank you very much! I’ll check if i can solve this issue…
If not I ll come back. 

Thanks. 
 

Why not just store the initial touch event:

local originalTouchEvent local function touch(e) if (e.phase == "began") then originalTouchEvent = e ...

I was keeping it simple and explaining every step   :wink: