Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Author Topic: Vector cast to object and retrieval in sendNotification  (Read 10528 times)
Sr. Member
Posts: 65

View Profile Email
« 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>);

Inside Component:

public function populate(leaderboardRowVOs:Vector.<LeaderboardRowVO>):void {
Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 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?

Pages: [1]