Mapped listeners are suddenly no longer invoked

Inxentas's Avatar

Inxentas

21 Apr, 2011 03:11 PM

I'm having quite the weird issue I ran into using Robotlegs. I never had this issue before, either in RL-based projects or native ones. It seems that after a while, each and every event is ignored. At first I thought Flash had hung, but I can still resize the Flash movie and it's still active, my OS or browser acts as if there is nothing wrong with the SWF at all, so it doesn't simply hang.

I have a few view components, simple sprites, that are mediated. I have a ZoomView (that has a dragger) and a CanvasView (basicly a Sprite that will contain other Sprites). Pulling the dragger in the ZoomView causes the CanvasView to move and scale, using a Command. The CanvasView can be dragged inside a bounding rectangle. This works fine, untill I hit some magical 5 minute barrier...

Suddenly EVERYTHING stops working. Resizing the stage no longer resizes the CanvasView. The CanvasView can no longer be dragged, and the ZoomView dragger no longer responds to the mouse.

  • Only events mapped with a Mediators eventMap are affected. I added a Timer instance to the ContextView and used addEventListener() to invoke a method every few seconds. This listener is the only one in the application that is unaffected.

  • Listeners in Mediators that are mapped with eventMap are no longer invoked. This includes both Event and MouseEvent instances.

  1. Support Staff 1 Posted by creynders on 21 Apr, 2011 03:17 PM

    creynders's Avatar

    Sounds to me like the context gets garbage collected. Do you store the context instance in a property?

  2. 2 Posted by Inxentas on 21 Apr, 2011 03:28 PM

    Inxentas's Avatar

    facepalm

    I just checked that and indeed: we did not store the context as a member of the initial view class. I did not realize it's necessity.

    I also did a little test by adding a MouseEvent handler to the CanvasView: it can still be invoked, even after the problem appears, so I think you are right and the context get's GC'd. Testing it now...

  3. 3 Posted by Inxentas on 21 Apr, 2011 03:41 PM

    Inxentas's Avatar

    It seems you were right about this. I stored the context and after 5 min. AFK it still works like a charm. I must have missed that part on the best practices page or something. Anyway, thanks again for your time and support Creynders!

    happyface

  4. Support Staff 4 Posted by creynders on 21 Apr, 2011 04:57 PM

    creynders's Avatar

    It could be it's not in the best practices, since it's standard behaviour of the flash player.
    Glad I could help!

  5. Stray closed this discussion on 29 Apr, 2011 04:56 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac