progress bar

hi,

i don’t see my error…i would have a progress bar depending of the the countTap but it’s seems that my “progressBar” don’t want to reduce. the process removeProgressBar() don’t work…why ?

thanks for your help.

--LEVEL-------------------------------------------------------------------------------------------------- local countTap = 0 local numberMaxProgressBar = 50 local progressBarLength = 10 --BACKGROUND BACK------------------------------------------------------------------------------------------- local BackgroundBack = display.newImageRect( myGroupBackgroundBack, "background.png", 240, 240) BackgroundBack.x = 240 BackgroundBack.y = 160 BackgroundBack.xScale = 10 BackgroundBack.yScale = 10 local flagButtonTouch =true local oRemove = display.remove local function calculateprogressbarlength() progressBarLength = countTap \* 5 print("progressBarLength", progressBarLength) return progressBarLength end local function mathcountTap() if progressBarLength \<= numberMaxProgressBar then countTap = countTap + 1 print ("countTap",countTap, "progressBarLength", progressBarLength ) end if progressBarLength \> numberMaxProgressBar then countTap = 0 end return countTap end local function createprogressbar() print("create") local progressBar = display.newImageRect( myGroupCharacter, "progress.png", progressBarLength, 16 ) progressBar.x, progressBar.y = display.contentWidth \* 0.5, display.contentHeight \* 0 return progressBar end local function removeProgressBar() oRemove(progressBar) progressBar = nil print("remove") end function BackgroundBack:touch( event ) mathcountTap() calculateprogressbarlength() createprogressbar() removeProgressBar() end BackgroundBack:addEventListener( "touch", BackgroundBack )

Hi @espace3d,

Have you considered using the Corona widget-based “progressView”? It’s very easy to configure and it should handle everything you need:

http://docs.coronalabs.com/api/library/widget/newProgressView.html

Brent

Thanks it’s work perfect :slight_smile:

But i don’t understand why my previous snippet don’t work…

hi Brent,

i don’t see how to change the color fill of the progress view ? By default is blue. Is it possible to change that without use a spritesheet ?

http://docs.coronalabs.com/api/library/widget/newProgressView.html

Hi @espace3d,

The standard blue progress view is made to match the iOS7/8 style. If you want to customize its visual appearance, you’ll need to use an image sheet. Fortunately, if you just want a basic progress bar without borders, the first three frames for the image sheet can essentially be disregarded (or left as pure transparent).

Take care,

Brent

Hi @espace3d,

Have you considered using the Corona widget-based “progressView”? It’s very easy to configure and it should handle everything you need:

http://docs.coronalabs.com/api/library/widget/newProgressView.html

Brent

Thanks it’s work perfect :slight_smile:

But i don’t understand why my previous snippet don’t work…

hi Brent,

i don’t see how to change the color fill of the progress view ? By default is blue. Is it possible to change that without use a spritesheet ?

http://docs.coronalabs.com/api/library/widget/newProgressView.html

Hi @espace3d,

The standard blue progress view is made to match the iOS7/8 style. If you want to customize its visual appearance, you’ll need to use an image sheet. Fortunately, if you just want a basic progress bar without borders, the first three frames for the image sheet can essentially be disregarded (or left as pure transparent).

Take care,

Brent