Overlay opened behind the active scene

Hi All,

I’m trying to use the Overlay to show a custom popUp message to the user.

On my active scene I’m calling the Overlay called  MessagePopUp  as showed below.

function scene:createScene( event )

    local group = self.view

    …   

    local options = {

        effect = “fade”,

        time = 400,

        isModal = true,

        params = { sample_var=456 }

    }

    storyboard.showOverlay( “MessagePopUp”, options )

    …

end

The MessagePopUp class is a simple class showed below:

local storyboard = require( “storyboard” )

local scene = storyboard.newScene()

– Clear previous scene

storyboard.removeAll()

function scene:createScene( event )

  local group = self.view

  local bg = display.newRect(group,     display.contentCenterX,display.contentCenterY,display.contentWidth,display.contentHeight)

  bg:setFillColor( 0, 0, 0, 0.5)

  local box = display.newImageRect( group, “images/box_bg.png”, 300, 200 )

  

  box.x = display.contentWidth/2;

  box.y = display.contentHeight/2;

end

The Overlay is opened but is behind the active scene… 

Can someone tell me what I’m doing wrong?

Thanks

This is symptomatic of your display objects in your parent scene not being in the scene’s group, or native objects which are always on top.

Rob

Thanks a lot! I’ve understood my error!

This is symptomatic of your display objects in your parent scene not being in the scene’s group, or native objects which are always on top.

Rob

Thanks a lot! I’ve understood my error!