Hello there,
i don’t know if somebody noticed or just me that eventListeners on newTextBox doesn’t work??
Is this a bug? or just the limitation of the newTextBox?
Thanks in advance,
Jam
Hello there,
i don’t know if somebody noticed or just me that eventListeners on newTextBox doesn’t work??
Is this a bug? or just the limitation of the newTextBox?
Thanks in advance,
Jam
Hi Jam,
Can you be more specific about the event listeners you’re talking about? Like tapping/touching, or dispatching some kind of event to it?
Thanks,
Brent
Hi Brent, thank for replying
here’s the code
local background = display.newRect( 0, 0, \_W, \_H ) background:setFillColor ( 0, 0, 0 ) background.alpha = 0.7 local briefDesc = myData.questionDescription local hintText = briefDesc local hintDesc = native.newTextBox ( 0, 0, \_W \* .93, \_W\*.69 ) hintDesc.font = native.newFont ( fontStyle ,20 ) hintDesc.hasBackground = true hintDesc.isEditable = false hintDesc.align = "left" hintDesc.text = hintText local function dblTap(event) print(event.numTaps) if event.numTaps == 2 then background:removeEventListener ( "tap", dblTap ) hintDesc:removeEventListener ( "tap", dblTap ) storyboard.hideOverlay() end end hintDesc:addEventListener ( "tap", dblTap ) background:addEventListener ( "tap", dblTap )
You see, this scene is like a pop up screen which has a text box on it. Then when I double tap screen it will close by itself.
In this case I have to put two event listeners on the two.
It works on the background, but on the newTextBox it doesn’t
Hi Jam,
In my experience/testing, text fields will hog the tap input, because that’s how the box detects if the user wants to interact with the box or not. I think you’ll need to work with some kind of background close method or create a more visual “close button” near/beside the box.
Take care,
Brent
ahh I see it now
thanks Brent, I’ll do the close button thing .
Thanks again,
Jam
Hi Jam,
Can you be more specific about the event listeners you’re talking about? Like tapping/touching, or dispatching some kind of event to it?
Thanks,
Brent
Hi Brent, thank for replying
here’s the code
local background = display.newRect( 0, 0, \_W, \_H ) background:setFillColor ( 0, 0, 0 ) background.alpha = 0.7 local briefDesc = myData.questionDescription local hintText = briefDesc local hintDesc = native.newTextBox ( 0, 0, \_W \* .93, \_W\*.69 ) hintDesc.font = native.newFont ( fontStyle ,20 ) hintDesc.hasBackground = true hintDesc.isEditable = false hintDesc.align = "left" hintDesc.text = hintText local function dblTap(event) print(event.numTaps) if event.numTaps == 2 then background:removeEventListener ( "tap", dblTap ) hintDesc:removeEventListener ( "tap", dblTap ) storyboard.hideOverlay() end end hintDesc:addEventListener ( "tap", dblTap ) background:addEventListener ( "tap", dblTap )
You see, this scene is like a pop up screen which has a text box on it. Then when I double tap screen it will close by itself.
In this case I have to put two event listeners on the two.
It works on the background, but on the newTextBox it doesn’t
Hi Jam,
In my experience/testing, text fields will hog the tap input, because that’s how the box detects if the user wants to interact with the box or not. I think you’ll need to work with some kind of background close method or create a more visual “close button” near/beside the box.
Take care,
Brent
ahh I see it now
thanks Brent, I’ll do the close button thing .
Thanks again,
Jam