Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Welcome, Guest. Please login or register.
December 14, 2017, 10:10:21 AM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Author Topic: Vector cast to object and retrieval in sendNotification  (Read 3123 times)
Sr. Member
Posts: 65

View Profile
« on: May 19, 2012, 02:39:36 AM »

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
« Reply #1 on: May 22, 2012, 07:01:23 AM »

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]
Jump to: