Hai all !!!
@Rob Miracle
i am newbie to programming and especially to corona sdk (LUA).i need a help!
The problem is :
I have 10 images in the array and a button while tap the button i need to remove the previous image and show the next image stored in array.
I did all ,but while tap for next image the next image is comes nicely, but the previous image is not removed from screen,
i want to remove it.,
Getting error as attempt to index global di1 in function onObjectTap function
and one more thing is after completing 10th image , i like to start from image 1,like a loop.
Any help regarding this will be great to me.,
thanks a lot in advance!!!
My code is here:
local Next = function()
for j = 1, 10 do
j=j+1
end
return true
end
local dotted = { “images/1.png”, “images/2.png” ,“images/3.png”,“images/4.png”,“images/5.png”,
“images/6.png”,“images/7.png”,“images/8.png”,“images/9.png”,“images/10.png”
}
local nextButton = widget.newButton{
left = display.contentWidth/1.25,
top = display.contentHeight - 55,
defaultFile=“images/next.png”,
width = 50, height = 50,
onRelease = Next
}
j = 1
function loadingImages1()
di = display.newImageRect(dotted[j],150,300);
di.x = calcx(40,“PER”)
di.y = calcx(30,“PER”)
di.height = calch(60,“PER”)
di.width = calcw(20,“PER”)
j = j + 1
end
local function onObjectTap( self,event )
di1:removeSelf();
loadingImages1()
return true
end
nextButton:addEventListener( “tap”, onObjectTap )