local storyboard = require ( “storyboard” )
local widget = require(“widget”)
local charts = require(“draw”)
local scene = storyboard.newScene()
local localGroup = display.newGroup()
function scene:createScene( event )
local group = self.view
local fun = draw.newLine
{
–Passing datas to draw line
} group:insert(fun)
end
I am using storyboard to display many items. In one tab, I am displaying some line graphs. So When I click that tab , the above code will be executed.
If I use the group:insert(fun) , the app hangs and getting the following error
ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ‘:’
So If I remove the group insert command. Everything works fine. But the line graph which I have drawn, is not removing from the screen when I switch between tabs [import]uid: 193230 topic_id: 32705 reply_id: 332705[/import]
@rleo2joseph,
It is a little unclear to me what the code above is for, but let me give you a suggestion anyways.
- Use a separate group to contain your line
- Create the group on entering the scene
- Insert the group into the self.view group that is provided by the scene
- After exiting the scene removeSelf() the group and set it to nil
Try something like this:
local lineGroup
function scene:willEnterScene( event )
local group = self.view
local lineGroup = display.newGroup()
group:insert( lineGroup )
-- Code to make the line here
-- be sure to insert the line into lineGroup
--
-- lineGroup:insert( 'newLine' )
end
function scene:didExitScene( event )
lineGroup:removeSelf
lineGroup = nil
end
(Tip: The forums support < code > and < / code > tags to make code easier to read.) [import]uid: 110228 topic_id: 32705 reply_id: 130086[/import]
@rleo2joseph,
It is a little unclear to me what the code above is for, but let me give you a suggestion anyways.
- Use a separate group to contain your line
- Create the group on entering the scene
- Insert the group into the self.view group that is provided by the scene
- After exiting the scene removeSelf() the group and set it to nil
Try something like this:
local lineGroup
function scene:willEnterScene( event )
local group = self.view
local lineGroup = display.newGroup()
group:insert( lineGroup )
-- Code to make the line here
-- be sure to insert the line into lineGroup
--
-- lineGroup:insert( 'newLine' )
end
function scene:didExitScene( event )
lineGroup:removeSelf
lineGroup = nil
end
(Tip: The forums support < code > and < / code > tags to make code easier to read.) [import]uid: 110228 topic_id: 32705 reply_id: 130086[/import]