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

Show Posts

| * |

  Show Posts
Pages: 1 [2]
16  PureMVC Manifold / Standard Version / Vector cast to object and retrieval in sendNotification 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);
}
17  PureMVC Manifold / Standard Version / notifyObservers edit suggested on: May 07, 2012, 12:59:52
Should be
  if (isset($this->observerMap[ $notification->getName() ]) && $this->observerMap[ $notification->getName() ] != null)
    ... 
  }

instead of
  if ($this->observerMap[ $notification->getName() ] != null) { //causes Notice: Undefined index:  (appearing if you send a notification inside a command)
    ...
  }

just like the way it's coded for registerObservers.

public function registerObserver( $notificationName, IObserver $observer ) {
  if (isset($this->observerMap[ $notificationName ]) && $this->observerMap[ $notificationName ] != null) {
    array_push( $this->observerMap[ $notificationName ], $observer );
  } else {
    $this->observerMap[ $notificationName ] = array( $observer );
  }
}
18  PureMVC Manifold / Standard Version / PureMVC with SWFAddress on: May 03, 2012, 07:06:15
Further to the approach mentioned in here:
http://pixelmelon.com/index.php?option=com_content&view=article&id=8:swfaddress-with-puremvc-single-core&catid=8&Itemid=25&showall=1&limitstart=

I'm trying to figure out the right approach.

1) As per the above article-> MenuComponent dispatch events, handled by MenuMediator which in turns sends a Notification handled by a UriAddressCommand, UriAddressCommand then retrieves the UriAddressProxy, call function to performs uri operations for browser which then sends a Notification handled by ViewMediators to display the related view.

2) In my approach, I'm not using Command, MenuMediator directly retrieves the UriAddressProxy, call function to perform uri operations for browser and which then sends a Notification handled by ViewMediators to display the related view.

It's the shortest way to go but I'm not sure if it's the right way to do. Please advise.
19  PureMVC Manifold / Multicore Version / puremvc.declare use on: April 19, 2012, 12:18:18
Any example please.

puremvc.declare("com.Test", { a: 4 });

//use
alert(com.Test.a);

please highlight on the scope param.
20  PureMVC Manifold / Standard Version / Best approach for Integrating Cache Mechanism inside PureMVC on: April 16, 2012, 11:13:45
Hi Cliff:

My context is basically PHP, posted under, http://forums.puremvc.org/index.php?topic=2021.0 but wanted to have your opinion in PureMVC way.

Thanks
21  PureMVC Manifold / Standard Version / Best approach for Integrating Cache Mechanism inside PureMVC-PHP on: April 16, 2012, 11:05:09
Hi:

I'm trying to work out a best approach for pulling content from cache before it connects to the Database (Proxy modules), I'm testing few ideas but I'm not sure which one is the best and the right approach.

1) Registering a CacheProxy that will check if the cache file exists and pull it or else register DatabaseProxy and Mediator and handle the request. (but I feel I'm coupling model with view because the cache files are basically view files).

2) Registering a Mediator with view component and view component will check if the cache file exists or else it will request mediator to register a proxy followed by calling a data request function on it, Proxy will send the Notification on data retrieval, and the same mediator will respond to notification and will set the data on the view component (kinda long way).

3) Current status of the system, I'm receiving the score request inside a command, say ScoreCommand and inside I'm registering a ScoreMediator and ScoreProxy and calling a retrieveRecords function on ScoreProxy for which ScoreMediator will respond to its notification, should I do if an else statement within command to check if cache exists before I even register ScoreMediator and ScoreProxy.

Thanks for any input, I look forward to feedback in language/platform independent manner, i.e. not the PHP or any other language way, the PureMVC way to handle Cache Mechanism.

P.S. I'm cautious about registering ScoreProxy, I want to register it only if I needed a connection to the database in case of "CACHE MISS" because it creates a database connection inside it's constructor.

22  PureMVC Manifold / Standard Version / toString function in INotification, on: April 11, 2012, 09:01:31
isn't it supposed to be the __toString() function?
23  PureMVC Manifold / Multicore Version / Extending/Inheriting using puremvc.define on: April 07, 2012, 08:47:08
a.js

puremvc.define(
{
    name: 'view.component.a',
   
    constructor: function(){
        alert('inside component a');
    }
}
);

b.js

puremvc.define(
{
    name: 'view.component.b',
    parent: view.component.a,
   
    constructor: function(){
        alert('inside constructor b');
    }
}
);

inside html (as a test)
        <script>
            //var a = new view.component.a();
            var b = new view.component.b();
        </script>

I'm trying to have the super constructor called while instantiating b, please advise. do we access to super something?
24  PureMVC Manifold / Standard Version / Inacessible method through a static type reference on: January 24, 2011, 07:27:11
Inside DragRaceMediator.as (it's basically my stageMediator or applicationMediator)

      override public function handleNotification(notification:INotification):void {
         switch(notification.getName()){
            case ApplicationFacade.SHOW_MENU:
               dragRace.showMenu(); //works fine here
               //viewComponent.showModal(); //works fine, method exists and gets called
               dragRace.showModal(); //throws inaccessible method error,
               break;
            
            default:
               break;
         }
      }

      
      private function get dragRace():DragRace {
         return viewComponent as DragRace;
      }


Inside DragRace.as (which is actually my main document file)

   public class DragRace extends MovieClip {

      private var _menu:Menu;   
      private var _modal:Modal;

      public function DragRace() {
         
         menu = new Menu();
         modal = new Modal();
         
         ApplicationFacade.getInstance().startup(this);
      }
      
      public function showMenu():void {
         addChild(menu);
         trace('show menu');
      }
      
      public function hideMenu():void {
         removeChild(menu);
      }
      
      public function showModal():void {
         trace('show modal');
         addChild(modal);
      }
      
      public function hideModal():void {
         removeChild(modal);
      }

      public function get menu():Menu {
         return _menu;
      }

      public function set menu(value:Menu):void {
         _menu = value;
      }

      public function get modal():Modal {
         return _modal;
      }

      public function set modal(value:Modal):void {
         _modal = value;
      }
         }
25  PureMVC Manifold / Standard Version / Using multiple instances of the same Mediator on: December 28, 2010, 05:57:10
http://blog.loadvars.com/2009/07/07/using-multiple-instances-of-the-same-mediator-in-puremvc/

In view of the above post, how to accomplish the same for Objective-C Port?
Pages: 1 [2]