Touch event not working in Overlay

Hey,

in fact is the Tap event does not work.

I have an overlay that closes on an event tap. When you press the button resume, nothing happens. I insert a print command inside the function but nothing is displayed.

Thanks for any help!

CODE: **********************************************

function og.d.cena:willEnterScene( pEv )    

    local loScene = self.view   

    

    og.m.objButton.g.sGroup = display.newGroup()

    og.m.objButton.g.sGroup.x = display.contentCenterX

    og.m.objButton.g.sGroup.y = display.contentCenterY

    local loOb1 = display.newSprite( pObj.i.imElements, pObj.f.anElements.f.animations() )

    loOb1.x = 0

    loOb1.y = 0

    loOb1:setSequence( “anWhite” )

    loOb1:play()     

    og.m.objButton.g.sGroup:insert(loOb1)     

    display.Remove( loOb1 )

    loOb1 = nil   

    local loOb2= display.newImage( pObj.i.imElements, pObj.t.enElements.t.enum.button4)    

    loOb2.xScale = 3

    loOb2.yScale    = 3

    loOb2.x = 0

    loOb2.y = 0

    og.m.objButton.g.sGroup:insert(loOb2)

    display.Remove( loOb2)

    loOb2= nil   

    

    og.f.onResume = function( pEv )

            print(“Test Test One Two”)

            local loPa = og.m.geGame.f.hideOverlay( )

            og.b.storyboard.hideOverlay( loPa.effect, loPa.time )

        return true

    end        

    

    og.m.objButton.g.sGroup:addEventListener( “tap”, og.f.onResume )

   

end

*************************************************************************

You’ve got a lot of funny variable naming going on. Are you sure that the functions and objects you’re referring to in the code are what you think they are? If you print out the function name on those lines, does it print the actual function name? (It will not look like a name, but will be a memory address.)

Also, you should wrap you code post in code quotes by highlighting it in the post editor and pressing the  <>  button.

Hi horacebury!

I tried print the function (print("og.f.onResume " … og.f.onResume)), simulator return a error: attermpt to concatenate field  og.f.onResume (a function value)

Put a , instead of …

Hi horacebury,

Thank you for your feedback!

my problem resolved! :smiley:

– ************************   Before (wrong) ************************  

function og.d.cena:enterScene( pEv ) 

    local loCena = self.view

    

    – FUNCTIONS

    og.f.onJump = function( pEv )    

        – Do something

        

        return true

    end        

    

    og.m.mrHero.g.sGroup:addEventListener( “tap”, og.f.onJump )    

end

– ************************  Now (Working) ************************  

function og.d.cena:willEnterScene( pEv )    

    local loCena = self.view

    

    – FUNCTIONS

    og.f.onJump = function( pEv )    

        – Do something

        

        return true

    end        

end

    

function og.d.cena:enterScene( pEv )    

    local loCena = self.view

    

    og.m.mrHero.g.sGroup:addEventListener( “tap”, og.f.onJump )    

end

You’ve got a lot of funny variable naming going on. Are you sure that the functions and objects you’re referring to in the code are what you think they are? If you print out the function name on those lines, does it print the actual function name? (It will not look like a name, but will be a memory address.)

Also, you should wrap you code post in code quotes by highlighting it in the post editor and pressing the  <>  button.

Hi horacebury!

I tried print the function (print("og.f.onResume " … og.f.onResume)), simulator return a error: attermpt to concatenate field  og.f.onResume (a function value)

Put a , instead of …

Hi horacebury,

Thank you for your feedback!

my problem resolved! :smiley:

– ************************   Before (wrong) ************************  

function og.d.cena:enterScene( pEv ) 

    local loCena = self.view

    

    – FUNCTIONS

    og.f.onJump = function( pEv )    

        – Do something

        

        return true

    end        

    

    og.m.mrHero.g.sGroup:addEventListener( “tap”, og.f.onJump )    

end

– ************************  Now (Working) ************************  

function og.d.cena:willEnterScene( pEv )    

    local loCena = self.view

    

    – FUNCTIONS

    og.f.onJump = function( pEv )    

        – Do something

        

        return true

    end        

end

    

function og.d.cena:enterScene( pEv )    

    local loCena = self.view

    

    og.m.mrHero.g.sGroup:addEventListener( “tap”, og.f.onJump )    

end