Problems with messages

58 views
Skip to first unread message

Hyspanux

unread,
Oct 9, 2013, 11:11:44 AM10/9/13
to aw...@googlegroups.com
Hello,

I can't make messages work. :_(
In other post https://groups.google.com/forum/#!topic/awe6/OEe1nOj8meM it's said to attach private Scene _entity  to get messages from a sender.

I  have different problems:

1.- Class Game on init() method I set

class Game extends AScene 
{

          override private function _init():Void 
          {
              ....

              _kernel.messenger.addSubscriber(_entity, EvBombo.FRAME0, onEvFrame0, bombo);
          }
public function onEvFrame0(event:EvBombo, p_sender:IEntity):Bool
{
_vueltas++;
return true;
}         
}


In my class Bombo I write:
class Bombo  extends Entity
{
    .....

override private function _updater( p_deltaTime:Int = 0 ):Void
{
super._updater( p_deltaTime );
                if (_frame == 0)
                      messenger.sendMessage(EvBombo.FRAME0, this);
        }
}

This code is suppose to make that every time bombo fires a message, Game add 1 to _vueltas.
But this never happends because in MessageManager, subscriptions returned by _getSubscriptions is null due to  i.subscriber != p_subscriber that is (Game != Bombo)

What do  I miss? 


2.- Another problem I have is that I  addSubscriber into init() function. when new scene came into play, SceneTransiction calls _disposer several times and my Game subscription is deleted.
When should I add subscriptions into my game?

thanks in advance
Hyspanux



Rob Fell

unread,
Oct 10, 2013, 2:36:59 PM10/10/13
to aw...@googlegroups.com
1) Thanks for reporting!   Yes, verified as a bug.  Without bubbling the subscriber does not receive the message.  This is not intended behavior and needs a fix.  Not sure how this got through, I'll review changelogs.  Workaround in the meanwhile is to include bubbling (up).
 
2) Adding subscriptions on _init is good.  SceneTransition should not call dispose multiple times (the isDisposed trigger should prevent that), can you provide contents of this Class / has it been extended?
 
Thanks

Rob Fell

unread,
Dec 10, 2013, 5:12:29 PM12/10/13
to aw...@googlegroups.com
I've attempted to fix this bug with revision 620.
Reply all
Reply to author
Forward
0 new messages