PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: saad on May 19, 2012, 02:39:36



Title: Vector cast to object and retrieval in sendNotification
Post by: saad on May 19, 2012, 02:39:36
It's an AS3 question, I'm having some problems in casting back to Vector, help please

Inside Proxy:
var leaderboardRowVOs:Vector.<LeaderboardRowVO> = new Vector.<LeaderboardRowVO>();
//populate routine
this.facade.sendNotification(ApplicationFacade.LEADERBOARD_SUCCESS, leaderboardRowVOs);

Inside Mediator
      override public function handleNotification(notification:INotification):void {
         switch(notification.getName()) {
            case ApplicationFacade.LEADERBOARD_SUCCESS:
               leaderboard.populate(notification.getBody() as Vector.<LeaderboardRowVO>);
               break;
         }
      }

Inside Component:

public function populate(leaderboardRowVOs:Vector.<LeaderboardRowVO>):void {
         trace(leaderboardRowVOs.length);
}


Title: Re: Vector cast to object and retrieval in sendNotification
Post by: puremvc on May 22, 2012, 07:01:23
I don't see anything wrong with this code except:

:
this.facade.sendNotification(ApplicationFacade.LEADERBOARD_SUCCESS, leaderboardRowVOs);
The 'this.facade' part is not necessary since the Proxy already has its own sendNotification() method, so just do this:
:
sendNotification(ApplicationFacade.LEADERBOARD_SUCCESS, leaderboardRowVOs);
Otherwise, I need a little more info. Are you getting a specific casting error or just not seeing the data? If  you set a breakpoint in the mediator on the 'leaderboard.populate' line and inspect variables, what does the note body contain?

-=Cliff>