How draw and delete a line with touch finger ?

Hi ,

I create a function I can draw lines with touch screen , but I can’t find the function to delete the line created ? how can I remove a previous line ? 

When you create a line, or any other display object, you should be storing that line in a variable:

local myLine = display.newLine(10,10,200,200)

Later when you want to dispose of it:

myLine:removeSelf()

myLine = nil

Hi Rob,

Thanks for respond.

when I draw a line I want to delete the half of the line , how can i do it ? just delete a part of the line ?

The answer to that really deals with your code design.  Are you only going to have one line active?  If so when you start your touch to start drawing the line, you can check to see if “myLine” is not nil, if so remove it and nil it, then start the drawing.

Hi Rob,

Thanks for respond.

 

when I draw a line I want to delete the half of the line , how can i do it ? just delete a part of the line ?

Im drawing a line, but i want to delete some sections of the line . How can I delete part of the previous line ?

thank you 

When you create a line, or any other display object, you should be storing that line in a variable:

local myLine = display.newLine(10,10,200,200)

Later when you want to dispose of it:

myLine:removeSelf()

myLine = nil

Hi Rob,

Thanks for respond.

when I draw a line I want to delete the half of the line , how can i do it ? just delete a part of the line ?

The answer to that really deals with your code design.  Are you only going to have one line active?  If so when you start your touch to start drawing the line, you can check to see if “myLine” is not nil, if so remove it and nil it, then start the drawing.

Hi Rob,

Thanks for respond.

 

when I draw a line I want to delete the half of the line , how can i do it ? just delete a part of the line ?

Im drawing a line, but i want to delete some sections of the line . How can I delete part of the previous line ?

thank you