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
|
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 ); } }
|
|
|
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.
|
|
|
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; } }
|
|
|
|
|
|