# Runtime Event Removal

**URL:** <https://forums.solar2d.com/t/runtime-event-removal/311316>\
**Category:** Uncategorized\
**Created:** [March 9, 2013, 9:40pm UTC](https://forums.solar2d.com/t/runtime-event-removal/311316 "2013-03-09T21:40:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vanheuverswyn](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/v/ecc23a/32.png) [@vanheuverswyn](https://forums.solar2d.com/u/vanheuverswyn)\
**Post date:** [March 9, 2013, 9:40pm UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/1 "2013-03-09T21:40:48Z")

</div>

So, I’m using the function below to return some tilt info. I am also removing the listener when I exit the scene using this - ` Runtime:removeEventListener( "accelerometer", onTilt )`.

However I notice that while viewing the Xcode console, the accelerometer events keep firing after I change scenes. Apparently NOT unloading the event listener. Any thoughts as to how I can remove that so as to not eat up memory and battery? What am I doing wrong? Thanks.

Brian

`  
local function onTilt( event )  
 motionx = (30 \* event.yGravity)   
 print(motionx)  
 if motionx \> 0 then  
 transition.to( homeSign, { time=300, rotation=3 })   
 else  
 transition.to( homeSign, { time=300, rotation=-3 })  
 end  
end  
Runtime:addEventListener( "accelerometer", onTilt )  
` [import]uid: 141982 topic\_id: 37285 reply\_id: 67285[/import]

---

<div class="post-metadata">

**Author:** ![Alex10](https://forums.solar2d.com/user_avatar/forums.solar2d.com/alex10/32/66_2.png) [@Alex10](https://forums.solar2d.com/u/Alex10)\
**Post date:** [March 10, 2013, 4:19am UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/2 "2013-03-10T04:19:49Z")

</div>

Check out this thread:

[https://developer.coronalabs.com/forum/2013/02/11/runtimeremoveeventlistener-messes-game](https://developer.coronalabs.com/forum/2013/02/11/runtimeremoveeventlistener-messes-game) [import]uid: 135394 topic\_id: 37285 reply\_id: 145537[/import]

---

<div class="post-metadata">

**Author:** ![vanheuverswyn](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/v/ecc23a/32.png) [@vanheuverswyn](https://forums.solar2d.com/u/vanheuverswyn)\
**Post date:** [March 10, 2013, 4:37am UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/3 "2013-03-10T04:37:02Z")

</div>

Perfect! Thanks! [import]uid: 141982 topic\_id: 37285 reply\_id: 145541[/import]

---

<div class="post-metadata">

**Author:** ![Deleur\_Apps](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/d/fbc32d/32.png) [@Deleur\_Apps](https://forums.solar2d.com/u/Deleur_Apps)\
**Post date:** [March 11, 2013, 1:12am UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/4 "2013-03-11T01:12:11Z")

</div>

quick question. How did you get the xcode console? [import]uid: 130035 topic\_id: 37285 reply\_id: 145584[/import]

---

<div class="post-metadata">

**Author:** ![vanheuverswyn](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/v/ecc23a/32.png) [@vanheuverswyn](https://forums.solar2d.com/u/vanheuverswyn)\
**Post date:** [March 11, 2013, 2:30am UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/5 "2013-03-11T02:30:34Z")

</div>

Open Xcode and plug your iPad in to your computer. When you do that, your iPad will appear on the left side of the Organizer window (click on Window/Organizer in Xcode to view that window).

Once in the Organizer, find your iPad and then click on “console” in the left hand pane.

While viewing the console, you can see all kinds of cool stuff…your print output and lots of other goodies.

Hope that helps.

Brian [import]uid: 141982 topic\_id: 37285 reply\_id: 145588[/import]

---

<div class="post-metadata">

**Author:** ![Alex10](https://forums.solar2d.com/user_avatar/forums.solar2d.com/alex10/32/66_2.png) [@Alex10](https://forums.solar2d.com/u/Alex10)\
**Post date:** [March 10, 2013, 4:19am UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/6 "2013-03-10T04:19:49Z")

</div>

Check out this thread:

[https://developer.coronalabs.com/forum/2013/02/11/runtimeremoveeventlistener-messes-game](https://developer.coronalabs.com/forum/2013/02/11/runtimeremoveeventlistener-messes-game) [import]uid: 135394 topic\_id: 37285 reply\_id: 145537[/import]

---

<div class="post-metadata">

**Author:** ![vanheuverswyn](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/v/ecc23a/32.png) [@vanheuverswyn](https://forums.solar2d.com/u/vanheuverswyn)\
**Post date:** [March 10, 2013, 4:37am UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/7 "2013-03-10T04:37:02Z")

</div>

Perfect! Thanks! [import]uid: 141982 topic\_id: 37285 reply\_id: 145541[/import]

---

<div class="post-metadata">

**Author:** ![Deleur\_Apps](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/d/fbc32d/32.png) [@Deleur\_Apps](https://forums.solar2d.com/u/Deleur_Apps)\
**Post date:** [March 11, 2013, 1:12am UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/8 "2013-03-11T01:12:11Z")

</div>

quick question. How did you get the xcode console? [import]uid: 130035 topic\_id: 37285 reply\_id: 145584[/import]

---

<div class="post-metadata">

**Author:** ![vanheuverswyn](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/v/ecc23a/32.png) [@vanheuverswyn](https://forums.solar2d.com/u/vanheuverswyn)\
**Post date:** [March 11, 2013, 2:30am UTC](https://forums.solar2d.com/t/runtime-event-removal/311316/9 "2013-03-11T02:30:34Z")

</div>

Open Xcode and plug your iPad in to your computer. When you do that, your iPad will appear on the left side of the Organizer window (click on Window/Organizer in Xcode to view that window).

Once in the Organizer, find your iPad and then click on “console” in the left hand pane.

While viewing the console, you can see all kinds of cool stuff…your print output and lots of other goodies.

Hope that helps.

Brian [import]uid: 141982 topic\_id: 37285 reply\_id: 145588[/import]
