here’s a quick little sample of what i’m doing in one of my games for a warning popup before reseting some values. the size of the text and the color my be a bit tricky to follow if your new to programming
[code]
local storyboard = require(“storyboard”)
local widget = require(“widget”)
local scene = storyboard.newScene()
local _w, _h = display.contentWidth/2, display.contentHeight/2
local box
local data = { { “Reset”, “”, “WARNING !!!”, “”, “this action will”, “reset level locks”, “and highscore.”, “continue ?”}, { “yes”, “no” }}
function scene:createScene( event )
local screenGroup = self.view
box = display.newRect( 0, 0, 600, 500)
box:setFillColor(0, 0, 0, 150)
box:setStrokeColor(255, 255, 255)
box.strokeWidth = 2
box.x = _w
box.y = _h
screenGroup:insert( box )
for a = 1, #data[1] do
local txt = display.newText(data[1][a], 0, 0, native.systemFont, (32+(a < 4 and 1 or 0) * (32 - (( a < 2 and 0 or 1 ) * 20)) - (a > 1 and 1 or 0 ) * 8))
txt.x = _w
txt.y = _h / 2.7 + ( ( a - 1 ) * 48 )
txt:setTextColor( 50 + (( a<2 and 0 or 1 ) * 155), 230 - (( a<2 and 0 or 1 ) * 230), 10 + (( a<2 and 0 or 1 ) * 240), 150 )
screenGroup:insert(txt)
end
resetFnct = function()
local btn = {}
function btn.yes( event )
– put here what to do if yes selected
storyboard.hideOverlay( “fade”, 500 )
end
function btn.no( event )
storyboard.hideOverlay( “fade”, 500 )
end
for a = 1, #data[2] do
local btn = widget.newButton({
id = a,
top = (_h * 1.53),
left = (_w / 1.75) + (( a - 1 ) * 320),
label = data[2][a],
labelColor = { default = {50, 230, 10, 150} },
defaultColor= { 150, 150, 150, 150 },
fontSize = 32,
width = 160,
height = 64,
onRelease = btn[data[2][a]]
})
screenGroup:insert( btn )
end
end
resetFnct()
end
function scene:enterScene( event )
storyboard.stage:toFront()
end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
return scene
[import]uid: 7911 topic_id: 32790 reply_id: 130384[/import]