Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

I have a problem when scene change, please help
Started by bulcolimpex Mar 07 2020 04:35 AM

5 replies to this topic

Best Answer XeduR @Spyric , 07 March 2020 - 05:54 AM

You need to prevent such buttons from being touched again once a scene transition begins.

 

The simplest way to achieve this is to add an invisible rectangle on top of all other display groups that will capture all touch and tap events. When the scene transition begins, i.e. one of the buttons is pressed, you'd simply set .isHitTestable to true. Another approach is disabling any buttons that might cause issues during scene transitions. If you are using Corona's widget buttons, then you could alternatively use https://docs.coronalabs.com/api/type/ButtonWidget/setEnabled.html

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

bulcolimpex

[GLOBAL: userInfoPane.html]
bulcolimpex
  • Observer

  • 18 posts
  • Corona SDK

Hello,
 
I have a scene with 3 buttons.
 
When I went to the next scene and accidentally touched screen where one of the buttons on the previous one was scene the button from the previous scene is activated and opens an unwanted and unforeseen scene.
 
Even if you find it silly my question, please help because I can't handle it myself.
 
Thanks for understanding and excuse me for my bad English.
 


[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,246 posts
  • Corona SDK

  Best Answer

You need to prevent such buttons from being touched again once a scene transition begins.

 

The simplest way to achieve this is to add an invisible rectangle on top of all other display groups that will capture all touch and tap events. When the scene transition begins, i.e. one of the buttons is pressed, you'd simply set .isHitTestable to true. Another approach is disabling any buttons that might cause issues during scene transitions. If you are using Corona's widget buttons, then you could alternatively use https://docs.coronalabs.com/api/type/ButtonWidget/setEnabled.html


  • bulcolimpex likes this

[TOPIC: post.html]
#3

w967

[GLOBAL: userInfoPane.html]
w967
  • Observer

  • 25 posts
  • Corona SDK

image.png

 

Create a new project.
And choose this tamplate.

You will learn from him to solve your problem.



[TOPIC: post.html]
#4

bulcolimpex

[GLOBAL: userInfoPane.html]
bulcolimpex
  • Observer

  • 18 posts
  • Corona SDK

You need to prevent such buttons from being touched again once a scene transition begins.

 

The simplest way to achieve this is to add an invisible rectangle on top of all other display groups that will capture all touch and tap events. When the scene transition begins, i.e. one of the buttons is pressed, you'd simply set .isHitTestable to true. Another approach is disabling any buttons that might cause issues during scene transitions. If you are using Corona's widget buttons, then you could alternatively use https://docs.coronalabs.com/api/type/ButtonWidget/setEnabled.html

 

Thanks for the tip XeduR @Spyric, I use widget buttons and this works great for me. Following your advice on hiding the scene, I turn off all the buttons and the application works perfectly. Once again thank you.

This is the best answer for me.



[TOPIC: post.html]
#5

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 2,219 posts
  • Corona SDK

Invisible rect is by far the best way to block UX on scene transitions.  You can even extend storyboard/composer API to include this.  Then you just call *.blockUI() and *.enableUI() when needed.



[TOPIC: post.html]
#6

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,246 posts
  • Corona SDK

I've actually been looking into the Composer framework quite a bit and it seems that there already is an invisible rect built-in that blocks touches and taps, but it is positioned incorrectly and it is using incorrect width and height values so it doesn't actually block all touches if the actual device's display is wider or taller than the one defined in config.lua




[topic_controls]
[/topic_controls]