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] 3
|
17
|
Announcements and General Discussion / Architecture / Re: Air sqlite Proxy question
|
on: March 07, 2008, 04:43:54
|
ok, so what about this line of thought. I have one database, three proxies. The proxies are databaseProxy, userProxy, and playProxy.
I'm basically creating the databaseProxy in order to create one point of access to database creation and access (I'm going to try and use the DAO pattern for the creation and access).
So in my modelPrepCommand I have
facade.registerProxy(new databaseProxy()); var dbProxy = facade.retrieveProxy( databaseProxy.NAME ) as databaseProxy; facade.registerProxy(new userProxy(dbProxy)); facade.registerProxy(new playProxy(dbProxy));
Then I can access that databaseProxy from my user and play Proxies using the getData method they inherit from Proxy. Is this a good way to structure this 2 proxies wanting different portions of the same dataobject?
|
|
|
23
|
Announcements and General Discussion / Architecture / Re: ViewStacks, Mediators and Deferred Instantiation
|
on: March 05, 2008, 10:19:48
|
Yeah, about commands. I've read your documentation, read a ton of blogs about puremvc and thought I understood them until I started working with this stuff. I don't see any reason to do any commands yet in my application (outside of startup). Do commands make more sense when you have more than one thing to do off of an event? Right now my stuff is real basic, pressing a button and then switching a viewstack selected index.
Also, earlier in this post you wrote selectedIndex="{currentView}"
did you mean selectedIndex="{currentViewSelector}"
or am I super dense?
|
|
|
25
|
Announcements and General Discussion / Architecture / Best Practices Question -- menu component
|
on: March 05, 2008, 02:34:51
|
I have a set of buttons that when clicked create a new Menu. In that menu I want to be able to trap mouseclicks and create an event that will talk with the appropriate mediator. Can anybody tell me if I am doing this in the recommended PureMVC way. Here is my code for the menu component.
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="1000" height="200"> <mx:Metadata> [Event('importGame')] [Event('modifyGame')] [Event('generateReports')] [Event('exportData')] </mx:Metadata> <mx:Script> <![CDATA[ import mx.controls.Menu; import com.wolffebrothers.gametimetech.*;
public static const importGame:String = "importGame"; public static const modifyGame:String = "modifyGame"; public static const generateGame:String = "generateReports"; public static const exportGame:String = "exportData"; // Create and display the Menu control. private function createAndShow():void { //call notification ? JJM var myMenu:Menu = Menu.createMenu(null, myMenuData, false); myMenu.labelField="@label"; myMenu.show(10, 50); myMenu.addEventListener(MouseEvent.CLICK, mainMenuClicked); } public function mainMenuClicked(event:Event):void { trace("Main menu clicked"); dispatchEvent( new Event( importGame ) ); } ]]> </mx:Script> <!-- send to Proxy JJM --> <!-- Define the menu data. --> <mx:XML format="e4x" id="myMenuData"> <root> <menuitem label="Import New Game Data"/> <menuitem label="Modify Existing Game"/> <menuitem label="Generate Reports"/> <menuitem label="Export Data"/> </root> </mx:XML> <!-- call notification JJM --> <!-- Define a Button control to open the menu --> <mx:HBox> <mx:Button id="Stats" label="Stats" click="createAndShow();"/> <mx:Button id="PlayBook" label="Play Book" click="createAndShow();" enabled="false"/> <mx:Button id="VideoAnalysis" label="Video Analysis" click="createAndShow();" enabled="false"/> <mx:Button id="Recruiting" label="Recruiting" click="createAndShow();" enabled="false"/> </mx:HBox> </mx:Canvas>
|
|
|
26
|
Announcements and General Discussion / Architecture / Air sqlite Proxy question
|
on: March 05, 2008, 01:35:41
|
Hello. I am building an air application with puremvc. I am trying to use the sqlite database on the project as well. I've got a login box that is tied to a userproxy. In the userproxy I've put the database connection/creation code, in the constructor. Putting the code in the user proxy seems like a bad place to me because I have other proxies that need to get information from the same database. What should I do here? Is there a recommended central place that I create the database connection and have it available to all proxies for sql inserts, selects etc. ? Should I use a bunch of different databases? Here is a portion of my code in the userproxy. Is it bad form?
public class UserProxy extends Proxy implements IProxy { public static const NAME:String = "UserProxy"; private var _sqlConnection:SQLConnection; private var _dbFile:File; public function UserProxy ( data:Object = null ) { super ( NAME, data ); _sqlConnection = new SQLConnection(); _sqlConnection.addEventListener(SQLEvent.OPEN, openHandler); _sqlConnection.addEventListener(SQLErrorEvent.ERROR, errorHandler);
_dbFile = File.applicationStorageDirectory.resolvePath("gTT.db"); _sqlConnection.openAsync(_dbFile);
}
|
|
|
29
|
Announcements and General Discussion / Architecture / ViewStacks, Mediators and Deferred Instantiation
|
on: March 02, 2008, 04:50:57
|
Starting to make more sense now. I'm still not there but I had a flash of thinking I knew what was going on, and that was cool. I have another question that relates to this. I've been reading about deferring view instantiation with PureMVC on a few forums. I've been creating each 'page' of my app as a module and was going to load them when needed. Am I going to have to do this deferred instaniation stuff? Is this a good idea considering I'm developing an AIR app?
Thanks in advance. Josh
|
|
|
|
|
|