ScrollView problem

Im traying to add object to the scrollview and this is what happen:

"ERROR:Table expected. if this is a function call, you might have used ‘.’ instead of ‘:’ "

What is that???

code: This code is works:

scrollView = widget.newScrollView { -- ScrollView settings width = \_W, height = 1760, horizontalScrollDisabled = true, hideBackground = true, friction = 0.988, x = display.contentCenterX, y = \_H\*0.55, isBounceEnabled = false, bottomPadding = 260, hideScrollBar = true } for i = 1, #allballs do Frames[i] = display.newImage( "Frame.png" ) Frames[i].height = 0.12\*\_H Frames[i].width = 0.38\*\_W Frames[i].ballImage = allballs[i].Image Frames[i].Purchased = allballs[i].Purchased Frames[i].Price = allballs[i].Price Frames[i].Place = i if (i%2==0) then Frames[i].y=(i-1)\*140 Frames[i].x = 0.27\*\_W PositionY = (i-1)\*140 PositionX = 0.27\*\_W else Frames[i].y=i\*140 Frames[i].x = 0.73\*\_W PositionY = i\*140 PositionX = 0.73\*\_W end if (allballs[i].Purchased) then balls[i] = display.newImage( allballs[i].Image ) balls[i].height = 0.15\*\_W balls[i].width = 0.15\*\_W balls[i].x = PositionX balls[i].y = PositionY else local txtoptions = { text = allballs[i].Price, x = PositionX+0.055\*\_W, y = PositionY, width = 0.23\*\_W, font = native.systemFontBold, fontSize = \_W\*0.1, align = "left" } balls[i] = display.newText( txtoptions ) end Frames[i]:setFillColor( 1, 1, 0.4 ) Frames[i]:addEventListener( "tap", sellectball ) scrollView:insert( Frames[i] ) scrollView:insert( balls[i] ) end

Everything works perfectly. But when I add this (between the ***):

for i = 1, #allballs do Frames[i] = display.newImage( "Frame.png" ) Frames[i].height = 0.12\*\_H Frames[i].width = 0.38\*\_W Frames[i].ballImage = allballs[i].Image Frames[i].Purchased = allballs[i].Purchased Frames[i].Price = allballs[i].Price Frames[i].Place = i if (i%2==0) then Frames[i].y=(i-1)\*140 Frames[i].x = 0.27\*\_W PositionY = (i-1)\*140 PositionX = 0.27\*\_W else Frames[i].y=i\*140 Frames[i].x = 0.73\*\_W PositionY = i\*140 PositionX = 0.73\*\_W end if (allballs[i].Purchased) then balls[i] = display.newImage( allballs[i].Image ) balls[i].height = 0.15\*\_W balls[i].width = 0.15\*\_W balls[i].x = PositionX balls[i].y = PositionY else local txtoptions = { text = allballs[i].Price, x = PositionX+0.055\*\_W, y = PositionY, width = 0.23\*\_W, font = native.systemFontBold, fontSize = \_W\*0.1, align = "left" } balls[i] = display.newText( txtoptions ) coin = display.newImage( "coin.png", PositionX-0.07\*\_W, PositionY) coin.width = \_W\*0.05 coin.height = \_H\*0.05 end Frames[i]:setFillColor( 1, 1, 0.4 ) Frames[i]:addEventListener( "tap", sellectball ) scrollView:insert( Frames[i] ) scrollView:insert( balls[i] ) scrollView:insert( coin ) end

It dosent work…

Hi @idanahal3,

By “add object”, how are you attempting it? Objects should be added using the standard “:insert” API:

https://docs.coronalabs.com/api/type/GroupObject/insert.html

Best regards,

Brent

Hi @idanahal3,

By “add object”, how are you attempting it? Objects should be added using the standard “:insert” API:

https://docs.coronalabs.com/api/type/GroupObject/insert.html

Best regards,

Brent