have this error when i change the scene with storyboard.purgeAll(), i don’t know what to do anymore !!
thanks for locking at the problem: Corona Build 826
error:
Runtime error
?:0: attempt to index field ‘target’ (a nil value)
stack traceback:
[C]: ?
?: in function ‘listener’
?: in function ‘?’
?: in function <?:1227>
?: in function <?:226>
code:
function sceneGaren:createScene( event )
local group = self.view
local bg = display.newRect( group, 0, top, 320, 390 )
bg:setFillColor( 255 )
storyboard.purgeAll()
local list = widget.newTableView{
top = top,
height = 398,
maskFile = “assets/mask-320x403.png”
}
local function onRowRender( event )
local row = event.row
local rowGroup = event.view
local color = 0
chosenRowIndex = row.index
name = display.newRetinaText(sceneGarenTabelle[chosenRowIndex].name, 0, 0, native.systemFont, 16 )
name:setTextColor( color )
name:setReferencePoint( display.TopLeftReferencePoint )
name.x = 69
name.y = 11
rowGroup:insert( name )
icon = display.newImage(“icons/”…sceneGarenTabelle[chosenRowIndex].icon)
icon:setReferencePoint( display.CenterLeftReferencePoint )
icon.x = 10
icon.y = row.height * 0.5
icon.xScale = 0.45
icon.yScale = 0.45
rowGroup:insert( icon )
end
local function rowListener( event )
local row = event.row
local rowGroup = event.view
local background = event.background
local target = event.target
if event.phase == “release” or event.phase == “tap” then
background:setFillColor( 0, 110, 233, 255 )
row.reRender = true
chosenRowIndex = row.index
storyboard.gotoScene( “sceneGarenErweitert”)
end
end
local rowHeight = 44; local listener = rowListener; local t = 1;
for ident, part, icon, sort, name in db:urows([[select produkt.ident, produkt.part,produkt.icon,produkt.sort,produkt_lang.name from produkt, produkt_lang where produkt.ident = produkt_lang.ident and produkt.part = 0 and produkt_lang.language = ‘]]…inputLang…[[’ order by sort]]) do
if debug == 1 then print(ident, part, icon, sort, name) end
sceneGarenTabelle[t] = {}
sceneGarenTabelle[t].ident = ident
sceneGarenTabelle[t].part = part
sceneGarenTabelle[t].icon = icon
sceneGarenTabelle[t].sort = sort
sceneGarenTabelle[t].name = name
list:insertRow{
height = rowHeight,
onRender = onRowRender,
listener = rowListener
}
t = t + 1
end
t = nil
editButton = widget.newButton{
style = “blue1Small”,
label = trans(“edit”), yOffset = -2,
onRelease = function() storyboard.gotoScene( “sceneedit” ); end
}
editButton.x = 285
editButton.y = titleBar.y
group:insert( editButton )
group:insert( list )
end
sceneGaren:addEventListener( “createScene”, sceneGaren )
–SCENE sceneGarenErweitert
function sceneGarenErweitert:createScene( event )
local group = self.view
local bg = display.newRect( group, 0, top, 320, 390 )
bg:setFillColor( 255 )
storyboard.purgeAll()
local list = widget.newTableView{
top = top,
height = 398,
maskFile = “assets/mask-320x403.png”
}
local function onRowRender( event )
local row = event.row
local rowGroup = event.view
local color = 0
chosenRowIndex = row.index
name = display.newRetinaText(sceneGarenErweitertTabelle[chosenRowIndex].name, 0, 0, native.systemFont, 16 )
name:setTextColor( color )
name:setReferencePoint( display.TopLeftReferencePoint )
name.x = 69
name.y = 11
rowGroup:insert( name )
icon = display.newImage(“icons/”…sceneGarenErweitertTabelle[chosenRowIndex].icon)
icon:setReferencePoint( display.CenterLeftReferencePoint )
icon.x = 10
icon.y = row.height * 0.5
icon.xScale = 0.45
icon.yScale = 0.45
rowGroup:insert( icon )
end
local function rowListener( event )
local row = event.row
local rowGroup = event.view
local background = event.background
if event.phase == “release” or event.phase == “tap” then
background:setFillColor( 0, 110, 233, 255 )
row.reRender = true
chosenRowIndex = row.index
storyboard.gotoScene( “sceneTools”)
end
end
local rowHeight = 44; local listener = rowListener; local t = 1;
for ident, part, icon, sort, name in db:urows([[select produkt.ident, produkt.part,produkt.icon,produkt.sort,produkt_lang.name from produkt, produkt_lang where produkt.ident = produkt_lang.ident and produkt.part = ‘]]…sceneGarenTabelle[chosenRowIndex].ident…[[’ and produkt_lang.language = ‘]]…inputLang…[[’ order by sort]]) do
if debug == 1 then print(ident, part, icon, sort, name) end
sceneGarenErweitertTabelle[t] = {}
sceneGarenErweitertTabelle[t].ident = ident
sceneGarenErweitertTabelle[t].part = part
sceneGarenErweitertTabelle[t].icon = icon
sceneGarenErweitertTabelle[t].sort = sort
sceneGarenErweitertTabelle[t].name = name
list:insertRow{
height = rowHeight,
onRender = onRowRender,
listener = rowListener
}
t = t + 1
end
t = nil
editButton = widget.newButton{
style = “blue1Small”,
label = trans(“edit”), yOffset = -2,
onRelease = function() storyboard.gotoScene( “sceneedit” ); end
}
editButton.x = 285
editButton.y = titleBar.y
group:insert( editButton )
group:insert( list )
end
sceneGarenErweitert:addEventListener( “createScene”, sceneGarenErweitert ) [import]uid: 73028 topic_id: 26954 reply_id: 326954[/import]