Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Overlays and Listeners problem!
Started by ammar71 Jun 02 2019 08:21 AM

1 reply to this topic

Best Answer ammar71 , 05 June 2019 - 06:32 AM

I managed to solve it by not calling the 2nd modal overlay (step 3 above) directly. I use a delay function instead.

timer.performWithDelay( 100, show_correct_answer)

 

Where show_correct_answer is a function that shows the 2nd modal overlay.

 

I stll don't know what caused it, but at least I have a way around it.

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

ammar71

[GLOBAL: userInfoPane.html]
ammar71
  • Enthusiast

  • 32 posts
  • Corona SDK

Hi all,

 

I am having a strange problem where listeners stop working after I return from an overlay. I can't post code because it is too big but basically what I am trying to do is:

 

1- User presses a button: Open a modal overlay that has choices.

2- User clicks on a choice (on the overlay): I close the overlay and go back to function "Check_Choice" on parent.

3- If choice is correct: Show another modal overlay with an image indicating a "Correct Answer".

4- User presses the image "Correct Answer": We go back to function "next_level" on parent.

 

When I am in the "next_level" function, I seem to lose all the event listeners on the parent. Even if I use composer to go to a different scene, I still seem not to have any listeners active.

 

My question is:

Is it OK to show an overlay from within function "Check_Choice" bearing in mind it is the function called from the first overlay? Or does that mean I have two modal overlays active t the same time?

 

How do I go about debugging this to know at which point exactly do I lose the listeners? I have downloaded sublime and I can set breakpoints, but how do I examine the state of listeners? Is there an internal table that I need to print?

 

Many thanks. 



[TOPIC: post.html]
#2

ammar71

[GLOBAL: userInfoPane.html]
ammar71
  • Enthusiast

  • 32 posts
  • Corona SDK

  Best Answer

I managed to solve it by not calling the 2nd modal overlay (step 3 above) directly. I use a delay function instead.

timer.performWithDelay( 100, show_correct_answer)

 

Where show_correct_answer is a function that shows the 2nd modal overlay.

 

I stll don't know what caused it, but at least I have a way around it.




[topic_controls]
[/topic_controls]