# How do I make something happen when a screen is closed?

**URL:** <https://community.thunkable.com/t/how-do-i-make-something-happen-when-a-screen-is-closed/1194816>\
**Category:** Questions about Thunkable X\
**Created:** [March 30, 2021, 4:15am UTC](https://community.thunkable.com/t/how-do-i-make-something-happen-when-a-screen-is-closed/1194816 "2021-03-30T04:15:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![roaringtiger2000s2o8](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/roaringtiger2000s2o8/32/89859_2.png) [@roaringtiger2000s2o8](https://community.thunkable.com/u/roaringtiger2000s2o8)\
**Post date:** [March 30, 2021, 4:15am UTC](https://community.thunkable.com/t/how-do-i-make-something-happen-when-a-screen-is-closed/1194816/1 "2021-03-30T04:15:39Z")

</div>

Hey,

I’m trying to make a component do something, but when a screen is closed…  
More specifically, I’m working with canvas blocks (make a block move when a screen is closed).

How do I go about this?

Thank you for your time,  
Hobi

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 30, 2021, 4:20am UTC](https://community.thunkable.com/t/how-do-i-make-something-happen-when-a-screen-is-closed/1194816/2 "2021-03-30T04:20:10Z")

</div>

What kind of navigation are you using between screens?

---

<div class="post-metadata">

**Author:** ![roaringtiger2000s2o8](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/roaringtiger2000s2o8/32/89859_2.png) [@roaringtiger2000s2o8](https://community.thunkable.com/u/roaringtiger2000s2o8)\
**Post date:** [March 30, 2021, 4:21am UTC](https://community.thunkable.com/t/how-do-i-make-something-happen-when-a-screen-is-closed/1194816/3 "2021-03-30T04:21:28Z")

</div>

Well, if someone decides to switch screens using the top menu, this should come into play.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 30, 2021, 4:44am UTC](https://community.thunkable.com/t/how-do-i-make-something-happen-when-a-screen-is-closed/1194816/4 "2021-03-30T04:44:50Z")

</div>

So you’re using a Top Tab navigator? I don’t see any way to do that with a navigator. You can use the Screen Open block but there isn’t a Screen Closed event block.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 30, 2021, 10:33am UTC](https://community.thunkable.com/t/how-do-i-make-something-happen-when-a-screen-is-closed/1194816/5 "2021-03-30T10:33:38Z")

</div>

Use an app variable (for example, activeScreen) to store the name of the active screen.

Update the variable activeScreen with the screen open event. For example, activeScreen=screen3

In the screen open event check if the activeScreen is equal the screen name you want. This means that the previous screen is the screen you want and then do the code you want to do and change the variable to the new screen.

This way, you will be executing codes on close of screen (with a twist).

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:25pm UTC](https://community.thunkable.com/t/how-do-i-make-something-happen-when-a-screen-is-closed/1194816/6 "2024-11-08T13:25:39Z")

</div>


