Line.append dynamically

I can't seem to append points to the end of a line dynamically - the added points are invisible until I add a new display object to the scene.

This works to get the result I need:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local function updateLine(self)
        if(self.circle ~= nil) then self.circle:removeSelf(); end
        self.circle = display.newCircle(0,0,1);
        self.circle.isVisible = false;
        self.group:insert(self.circle);
end
 
local function drawLine(self)
        --.......................................
        -- Somewhere along the way self.lineTrace was initialized
        -- ......................................
        local curPoint = self.vector[curPointNumber];
        self.lineTrace:append(curPoint[1], curPoint[2]);
        updateLine(self);       
end
 
-- Then I call this drawLine method in response to touch events

Came up with this bit:

1
2
3
local function updateLine(self)
        self.lineTrace.width = (self.lineTraceWidth * 2 + 1) - self.lineTrace.width;
end
views:1518 update:2011/9/28 8:56:32
corona forums © 2003-2011