Hii im making game with basically 2 scenes. when i test it on iphone 4 everything is perfect… but when it comes to iphone 3g the aplication becomes slow… i mean every time i do somthing like changing the scene is gos slow and slow and slow… i wonder if its has somthing to do with memory being drain or somthing…
what im doing… ok basically i have an array of gorups. i will make some code here to explain it better…
[lua]local sheetIMG = {} --this is local for the main.lua file
function populateIMG()
for x = 1,10 do
local group = display.newGroup()
local img = display.newImage(“deck”…deck…"/"…y…".png")
group:insert(img,true)–accesible en buttonlistener como group[1]
group.id = x
group:addEventListener( “touch”, myEvent)
sheetIMG[#sheetIMG+1]=group
end
end[/lua]
ok soo i have an array of 10 groups cointaingin display objects and some custom properties like id…
when the scene is done… i destroy the objects… like…
[lua]–remove the gropus in the arry
for x = 1,#sheetIMG do
sheetIMG[x]:removeSelf()
end
–remove the array items soo lenght will be 0
while(#sheetIMG>0) do
table.remove(sheetIMG,1)
end[/lua]
and when the scene is set up again i do the first piese of code…
sooo the big questions is what im doing bad?..
it seems somthig still there taking psocesing time or causin some ram problems…
do i need to remove event listeners beroe removing the gropus in the arry ?
do i need to remove every group member before removing the group from the arry?
do i need to set group.id = nil ?
hope you guys can help me…
[import]uid: 4936 topic_id: 2918 reply_id: 302918[/import]