Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 80 lines (57 sloc) 1.687 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
local PopupA = {}
local PopupA_mt = { __index = PopupA }

local widget = require( "widget" )

--- Called when the scene is first initialised.
function PopupA:new()
    
    local self = {}
    
    setmetatable( self, PopupA_mt )
    
    return self
    
end

--- Called when the scene is first created.
-- @param data Optional data to pass on to the scene.
function PopupA:onCreate( data )

local back = display.newRect( 0, 0, 200, 200 )
back.x = display.contentCenterX
back.y = display.contentCenterY - 130
back:setFillColor( 0, 255, 255 )
self.view:insert( back )

local text = display.newText( "Popup A", 0, 0, "Helvetica", 30 )
text.x = back.x
text.y = back.y - back.contentHeight * 0.5 + text.contentHeight
text:setTextColor( 0, 0, 0 )
self.view:insert( text )

local onButtonEvent = function( event )
if event.phase == "release" then
         self.sceneManager:closePopup( self.name )
     end
     return true
end

local closeButton = widget.newButton
{
id = "close",
label = "Close",
width = 150,
height = 28,
cornerRadius = 8,
onEvent = onButtonEvent
}
closeButton.x = back.x
closeButton.y = back.y + back.contentHeight * 0.5 - closeButton.contentHeight
self.view:insert( closeButton )

end

--- Called in the enterFrame event.
function PopupA:onUpdate( event )

end

--- Called when the scene is about to get loaded.
function PopupA:onLoad()

end

--- Called when the scene is about to get unloaded.
function PopupA:onUnload()

end

--- Called when the scene is ready, i.e. fully loaded and on the screen.
function PopupA:onReady()

end

--- Called when the scene is about to get destroyed.
function PopupA:onDestroy()

end

return PopupA
Something went wrong with that request. Please try again.