How to bring listener forward?

i was just a wondering how do i bring listener forward? Should :toFront() just bring the listener forwards? I have this thing in my main.lua (I would share but there is lots of stuff in it) it changes Scenes and has a in app notification pop down(which is just a display object that transition down and back up). And I have a touch listener on the pop down and the listener is not pick up because there is something else with a touch listener “behind” (at least display wise) the pop down. Hopefully that makes sense.

Thanks, Scott

You can’t move listeners up and down.  They are either tied to a display object which can be moved up and down (using :toFront() and :toBack())

It would be nice to know more about this “popdown” (most people would call it a popup).  We certainly don’t want to see your whole project file, but you could copy/paste the code where you’re creating the popdown and anything that’s on top of it.  If you do, please use the <> button in the edit bar (same row with Bold, Italics, etc.)

Rob

\<lua\> local messageBox messageBox= display.newRect( display.contentCenterX, ((display.actualContentHeight- display.contentHeight)\*.5)-25, display.actualContentWidth, 50 ) local textOptions2 = { text = "", x = messageBox.x, y = messageBox.y, width = display.actualContentWidth, height = 50, align = "center", font = native.systemFont, fontSize = 30 } local messageTxt= display.newText( textOptions2) local stringSize =0 local xNot= display.newImage("images/X.png",((display.actualContentWidth- display.contentWidth)\*.5)+20, ((display.actualContentHeight- display.contentHeight)\*.5)-25 ) local storeTable = {} mailBox = {} local messagePushStore= "" local typeStore= "" local valueStore= "" local lookedAtIt local noteGroup= display.newGroup( ) noteGroup:insert( messageBox ) noteGroup:insert( messageTxt ) noteGroup:insert( xNot ) function inAppPush( messagePush, type, value ) if (type == "message") then if (messageTxt.text == "") then messageTxt.text = messagePush messagePushStore = messagePush typeStore = type stringSize=string.len( messageTxt.text ) messageTxt:setFillColor( 0,0,0 ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))+50, onComplete= doneTran} ) else local i = #storeTable +1 storeTable[i] = messagePush..", "..type..", " end end if (type == "warning") then if (messageTxt.text == "") then messageTxt.text = messagePush messagePushStore = messagePush typeStore = type stringSize=string.len( messageTxt.text ) messageTxt:setFillColor( 0,0,0 ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))+50, onComplete= doneTran} ) else local i = #storeTable +1 storeTable[i] = messagePush..", "..type..", " end end end function doneTran( ) local timeToChange timeToChange = stringSize\* 300 lookedAtIt= timer.performWithDelay( timeToChange, goBack,1 ) end function goBack( ) --print("back1") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff} ) end function goBack2( ) --print("back2") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff3} ) end function goBack3( ) --print("back3") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff2} ) end function deleteStuff( ) --print( "deleteStuff" ) messageTxt.text = "" if (valueStore == "" and typeStore ~="" ) then if (typeStore == "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil ) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end elseif valueStore ~= "" and typeStore ~="" then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", "..valueStore..", " valueStore="" typeStore="" messagePushStore="" if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end end end function deleteStuff2( ) --print( "deleteStuff2" ) messageTxt.text = "" end function deleteStuff3( ) messageTxt.text = "" --print( "deleteStuff3" ) if (valueStore == "" and typeStore ~="" ) then if (typeStore == "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end elseif valueStore ~= "" and typeStore ~="" then if (typeStore== "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", "..valueStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end end end function string:split( inSplitPattern, outResults ) if not outResults then outResults = { } end local theStart = 1 local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) while theSplitStart do table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) ) theStart = theSplitEnd + 1 theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) end table.insert( outResults, string.sub( self, theStart ) ) return outResults end local function tryPush( ) messageBox:toFront( ) messageTxt:toFront( ) xNot:toFront( ) if (messageTxt.text == "") then local messagePush= {} local types = {} local values = {} for i=1, #storeTable do local myTable = {} myTable = storeTable[i]:split(", ") messagePush[i]= myTable[1] types[i]= myTable[2] if (myTable[3]) then values[i]= myTable[3] end storeTable[i]= nil end for i=1,#messagePush do inAppPush( messagePush[i], types[i] ) end end end function messageBox:touch(event) if (event.phase == "moved") then if (event.y\< event.yStart-10 ) then goBack2( ) end end end function xNot:tap( ) goBack3( ) end local checkForNot = timer.performWithDelay( 2000, tryPush , 0 ) messageBox:addEventListener( "touch", messageBox ) --Runtime:addEventListener( "enterFrame", looper ) xNot:addEventListener( "tap", xNot ) \</lua\>

here is main stuff, Not or note = notfication, and mailbox is some thing else that is used to put stuff in a table view. 

thanks, scott

Hmm, your code didn’t post well.  Did you click on the <> button and paste the code in?  Did you try and hand type <lua> tags?

Rob

\<lua\> messageBox= display.newRect( display.contentCenterX, ((display.actualContentHeight- display.contentHeight)\*.5)-25, display.actualContentWidth, 50 ) local textOptions2 = { text = "", x = messageBox.x, y = messageBox.y, width = display.actualContentWidth, height = 50, align = "center", font = native.systemFont, fontSize = 30 } messageTxt= display.newText( textOptions2) local stringSize =0 local xNot= display.newImage("images/X.png",((display.actualContentWidth- display.contentWidth)\*.5)+20, ((display.actualContentHeight- display.contentHeight)\*.5)-25 ) local storeTable = {} mailBox = {} local messagePushStore= "" local typeStore= "" local valueStore= "" local lookedAtIt local noteGroup= display.newGroup( ) noteGroup:insert( messageBox ) noteGroup:insert( messageTxt ) noteGroup:insert( xNot ) function inAppPush( messagePush, type, value ) if (type == "message") then if (messageTxt.text == "") then messageTxt.text = messagePush messagePushStore = messagePush typeStore = type stringSize=string.len( messageTxt.text ) messageTxt:setFillColor( 0,0,0 ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))+50, onComplete= doneTran} ) else local i = #storeTable +1 storeTable[i] = messagePush..", "..type..", " end end if (type == "warning") then if (messageTxt.text == "") then messageTxt.text = messagePush messagePushStore = messagePush typeStore = type stringSize=string.len( messageTxt.text ) messageTxt:setFillColor( 0,0,0 ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))+50, onComplete= doneTran} ) else local i = #storeTable +1 storeTable[i] = messagePush..", "..type..", " end end end function doneTran( ) local timeToChange timeToChange = stringSize\* 300 lookedAtIt= timer.performWithDelay( timeToChange, goBack,1 ) end function goBack( ) --print("back1") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff} ) end function goBack2( ) --print("back2") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff3} ) end function goBack3( ) --print("back3") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff2} ) end function deleteStuff( ) --print( "deleteStuff" ) messageTxt.text = "" if (valueStore == "" and typeStore ~="" ) then if (typeStore == "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil ) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end elseif valueStore ~= "" and typeStore ~="" then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", "..valueStore..", " valueStore="" typeStore="" messagePushStore="" if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end end end function deleteStuff2( ) --print( "deleteStuff2" ) messageTxt.text = "" end function deleteStuff3( ) messageTxt.text = "" --print( "deleteStuff3" ) if (valueStore == "" and typeStore ~="" ) then if (typeStore == "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end elseif valueStore ~= "" and typeStore ~="" then if (typeStore== "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", "..valueStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end end end function string:split( inSplitPattern, outResults ) if not outResults then outResults = { } end local theStart = 1 local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) while theSplitStart do table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) ) theStart = theSplitEnd + 1 theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) end table.insert( outResults, string.sub( self, theStart ) ) return outResults end local function tryPush( ) messageBox:toFront( ) messageTxt:toFront( ) xNot:toFront( ) if (messageTxt.text == "") then local messagePush= {} local types = {} local values = {} for i=1, #storeTable do local myTable = {} myTable = storeTable[i]:split(", ") messagePush[i]= myTable[1] types[i]= myTable[2] if (myTable[3]) then values[i]= myTable[3] end storeTable[i]= nil end for i=1,#messagePush do inAppPush( messagePush[i], types[i] ) end end end function messageBox:touch(event) if (event.phase == "began") then display.getCurrentStage():setFocus( event.target ) elseif (event.phase == "moved") then if (event.y\< event.yStart-10 ) then goBack2( ) end elseif event.phase == "ended" or event.phase == "began" then display.getCurrentStage():setFocus( nil ) end end function xNot:tap( ) goBack3( ) end local checkForNot = timer.performWithDelay( 2000, tryPush , 0 ) messageBox:addEventListener( "touch", messageBox ) --Runtime:addEventListener( "enterFrame", looper ) xNot:addEventListener( "tap", xNot ) \</lua\>

Is this better?

this is what i did.

https://youtu.be/QYVLdNpnZEc

Thanks, Scott

Yes, you did it right, but you didn’t need to type in the <lua> tags.  The code formatting button takes care of that for you.

Instead of doing this:

&nbsp;&nbsp;&nbsp;&nbsp;messageBox:toFront( ) &nbsp;&nbsp;&nbsp;&nbsp;messageTxt:toFront( ) &nbsp;&nbsp;&nbsp;&nbsp;xNot:toFront( )

try this instead:

noteGroup:toFront()

You can’t move listeners up and down.  They are either tied to a display object which can be moved up and down (using :toFront() and :toBack())

It would be nice to know more about this “popdown” (most people would call it a popup).  We certainly don’t want to see your whole project file, but you could copy/paste the code where you’re creating the popdown and anything that’s on top of it.  If you do, please use the <> button in the edit bar (same row with Bold, Italics, etc.)

Rob

\<lua\> local messageBox messageBox= display.newRect( display.contentCenterX, ((display.actualContentHeight- display.contentHeight)\*.5)-25, display.actualContentWidth, 50 ) local textOptions2 = { text = "", x = messageBox.x, y = messageBox.y, width = display.actualContentWidth, height = 50, align = "center", font = native.systemFont, fontSize = 30 } local messageTxt= display.newText( textOptions2) local stringSize =0 local xNot= display.newImage("images/X.png",((display.actualContentWidth- display.contentWidth)\*.5)+20, ((display.actualContentHeight- display.contentHeight)\*.5)-25 ) local storeTable = {} mailBox = {} local messagePushStore= "" local typeStore= "" local valueStore= "" local lookedAtIt local noteGroup= display.newGroup( ) noteGroup:insert( messageBox ) noteGroup:insert( messageTxt ) noteGroup:insert( xNot ) function inAppPush( messagePush, type, value ) if (type == "message") then if (messageTxt.text == "") then messageTxt.text = messagePush messagePushStore = messagePush typeStore = type stringSize=string.len( messageTxt.text ) messageTxt:setFillColor( 0,0,0 ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))+50, onComplete= doneTran} ) else local i = #storeTable +1 storeTable[i] = messagePush..", "..type..", " end end if (type == "warning") then if (messageTxt.text == "") then messageTxt.text = messagePush messagePushStore = messagePush typeStore = type stringSize=string.len( messageTxt.text ) messageTxt:setFillColor( 0,0,0 ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))+50, onComplete= doneTran} ) else local i = #storeTable +1 storeTable[i] = messagePush..", "..type..", " end end end function doneTran( ) local timeToChange timeToChange = stringSize\* 300 lookedAtIt= timer.performWithDelay( timeToChange, goBack,1 ) end function goBack( ) --print("back1") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff} ) end function goBack2( ) --print("back2") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff3} ) end function goBack3( ) --print("back3") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff2} ) end function deleteStuff( ) --print( "deleteStuff" ) messageTxt.text = "" if (valueStore == "" and typeStore ~="" ) then if (typeStore == "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil ) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end elseif valueStore ~= "" and typeStore ~="" then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", "..valueStore..", " valueStore="" typeStore="" messagePushStore="" if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end end end function deleteStuff2( ) --print( "deleteStuff2" ) messageTxt.text = "" end function deleteStuff3( ) messageTxt.text = "" --print( "deleteStuff3" ) if (valueStore == "" and typeStore ~="" ) then if (typeStore == "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end elseif valueStore ~= "" and typeStore ~="" then if (typeStore== "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", "..valueStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end end end function string:split( inSplitPattern, outResults ) if not outResults then outResults = { } end local theStart = 1 local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) while theSplitStart do table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) ) theStart = theSplitEnd + 1 theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) end table.insert( outResults, string.sub( self, theStart ) ) return outResults end local function tryPush( ) messageBox:toFront( ) messageTxt:toFront( ) xNot:toFront( ) if (messageTxt.text == "") then local messagePush= {} local types = {} local values = {} for i=1, #storeTable do local myTable = {} myTable = storeTable[i]:split(", ") messagePush[i]= myTable[1] types[i]= myTable[2] if (myTable[3]) then values[i]= myTable[3] end storeTable[i]= nil end for i=1,#messagePush do inAppPush( messagePush[i], types[i] ) end end end function messageBox:touch(event) if (event.phase == "moved") then if (event.y\< event.yStart-10 ) then goBack2( ) end end end function xNot:tap( ) goBack3( ) end local checkForNot = timer.performWithDelay( 2000, tryPush , 0 ) messageBox:addEventListener( "touch", messageBox ) --Runtime:addEventListener( "enterFrame", looper ) xNot:addEventListener( "tap", xNot ) \</lua\>

here is main stuff, Not or note = notfication, and mailbox is some thing else that is used to put stuff in a table view. 

thanks, scott

Hmm, your code didn’t post well.  Did you click on the <> button and paste the code in?  Did you try and hand type <lua> tags?

Rob

\<lua\> messageBox= display.newRect( display.contentCenterX, ((display.actualContentHeight- display.contentHeight)\*.5)-25, display.actualContentWidth, 50 ) local textOptions2 = { text = "", x = messageBox.x, y = messageBox.y, width = display.actualContentWidth, height = 50, align = "center", font = native.systemFont, fontSize = 30 } messageTxt= display.newText( textOptions2) local stringSize =0 local xNot= display.newImage("images/X.png",((display.actualContentWidth- display.contentWidth)\*.5)+20, ((display.actualContentHeight- display.contentHeight)\*.5)-25 ) local storeTable = {} mailBox = {} local messagePushStore= "" local typeStore= "" local valueStore= "" local lookedAtIt local noteGroup= display.newGroup( ) noteGroup:insert( messageBox ) noteGroup:insert( messageTxt ) noteGroup:insert( xNot ) function inAppPush( messagePush, type, value ) if (type == "message") then if (messageTxt.text == "") then messageTxt.text = messagePush messagePushStore = messagePush typeStore = type stringSize=string.len( messageTxt.text ) messageTxt:setFillColor( 0,0,0 ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))+50, onComplete= doneTran} ) else local i = #storeTable +1 storeTable[i] = messagePush..", "..type..", " end end if (type == "warning") then if (messageTxt.text == "") then messageTxt.text = messagePush messagePushStore = messagePush typeStore = type stringSize=string.len( messageTxt.text ) messageTxt:setFillColor( 0,0,0 ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))+50, onComplete= doneTran} ) else local i = #storeTable +1 storeTable[i] = messagePush..", "..type..", " end end end function doneTran( ) local timeToChange timeToChange = stringSize\* 300 lookedAtIt= timer.performWithDelay( timeToChange, goBack,1 ) end function goBack( ) --print("back1") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff} ) end function goBack2( ) --print("back2") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff3} ) end function goBack3( ) --print("back3") timer.cancel( lookedAtIt ) transition.to( noteGroup, {time = 400, y= ((display.actualContentHeight- display.contentHeight))-50, onComplete= deleteStuff2} ) end function deleteStuff( ) --print( "deleteStuff" ) messageTxt.text = "" if (valueStore == "" and typeStore ~="" ) then if (typeStore == "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil ) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end elseif valueStore ~= "" and typeStore ~="" then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", "..valueStore..", " valueStore="" typeStore="" messagePushStore="" if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end end end function deleteStuff2( ) --print( "deleteStuff2" ) messageTxt.text = "" end function deleteStuff3( ) messageTxt.text = "" --print( "deleteStuff3" ) if (valueStore == "" and typeStore ~="" ) then if (typeStore == "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end elseif valueStore ~= "" and typeStore ~="" then if (typeStore== "message") then local i = #mailBox +1 mailBox[i]=messagePushStore..", "..typeStore..", "..valueStore..", " valueStore="" typeStore="" messagePushStore="" end if (mailTable ~= nil) then local rowHeight = 40 local rowWidth = 100 local rowColor = { default = tableViewColors.rowColor.default, over = tableViewColors.rowColor.over, } local isCategory = false mailTable:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowWidth = rowWidth, rowColor = { default={ .4, 1, 1 }, over={ 1, 0.5, 0, 0.2 } }, lineColor = tableViewColors.lineColor, params = { defaultLabelColor=tableViewColors.defaultLabelColor, catLabelColor=tableViewColors.catLabelColor } } end end end function string:split( inSplitPattern, outResults ) if not outResults then outResults = { } end local theStart = 1 local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) while theSplitStart do table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) ) theStart = theSplitEnd + 1 theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) end table.insert( outResults, string.sub( self, theStart ) ) return outResults end local function tryPush( ) messageBox:toFront( ) messageTxt:toFront( ) xNot:toFront( ) if (messageTxt.text == "") then local messagePush= {} local types = {} local values = {} for i=1, #storeTable do local myTable = {} myTable = storeTable[i]:split(", ") messagePush[i]= myTable[1] types[i]= myTable[2] if (myTable[3]) then values[i]= myTable[3] end storeTable[i]= nil end for i=1,#messagePush do inAppPush( messagePush[i], types[i] ) end end end function messageBox:touch(event) if (event.phase == "began") then display.getCurrentStage():setFocus( event.target ) elseif (event.phase == "moved") then if (event.y\< event.yStart-10 ) then goBack2( ) end elseif event.phase == "ended" or event.phase == "began" then display.getCurrentStage():setFocus( nil ) end end function xNot:tap( ) goBack3( ) end local checkForNot = timer.performWithDelay( 2000, tryPush , 0 ) messageBox:addEventListener( "touch", messageBox ) --Runtime:addEventListener( "enterFrame", looper ) xNot:addEventListener( "tap", xNot ) \</lua\>

Is this better?

this is what i did.

https://youtu.be/QYVLdNpnZEc

Thanks, Scott

Yes, you did it right, but you didn’t need to type in the <lua> tags.  The code formatting button takes care of that for you.

Instead of doing this:

&nbsp;&nbsp;&nbsp;&nbsp;messageBox:toFront( ) &nbsp;&nbsp;&nbsp;&nbsp;messageTxt:toFront( ) &nbsp;&nbsp;&nbsp;&nbsp;xNot:toFront( )

try this instead:

noteGroup:toFront()