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]
1  Announcements and General Discussion / Architecture / component build with pure mvc loaded into fla built with mvc on: November 14, 2009, 12:50:35

I have written a component with pure mvc (single core) and am trying to load it into a swf that is build using pure mvc single core as well.  I can only instantiate one instance of applicationfacade, either I use the component mvc and it breaks the shell swf mvc or I use the shell pure mvc and it breaks the component mvc.  So, this sounds to me like I'm going to need to use the multi-core version of pure mvc.  Here are my questions....

1.  Does only the shell swf need to be multicore or do both the component and shell need to use multi-core?
2.  Do I actually need multicore or is there another way of getting around this.

I guess that is it.  Am I on the right path with my thinking?

2  Announcements and General Discussion / General Discussion / Execution of notification on: April 30, 2009, 08:57:51

I'm working on a progressBar for the loading of several local files in an AIR app.  I am sending notifications out of a loop that runs on every line of a file that has loaded.  I can't, for the life of me, get the progressbar to visually update, and was wondering if something may be weird with the way notifications work.  Do they dispatch events and run asynchronously with the execution thread or are they fired synchronously.  From what I've seen it looks pretty sycronous because I set breakpoints in my setProgress function which is supposed to update the progressBar.  I've tried just about everything with the progressBar, manual mode, event mode (dispatching my own ProgressEvents, etc.) and nothing will work.  I'm running mac os x10.4 and compiling for flash player 9.  Anybody have any ideas.  Here is a code snippet from where I'm updating the progressbar.  I know this post goes a little outside of PureMVC, but thought maybe, somewhere it has something to do with it, or at least it is worth my time asking.

Like I said, I can verify, through breakpoints, that setPercentage is getting called, but no visual result displayed.

<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml">
   <!--<mx:Dissolve id="myShow" duration="500" alphaFrom="0.0" alphaTo="1.0"/>-->
             import com.widgetmakers.coolwidget.globals.MessageStrings;
            [Bindable] private var progressLabel:String = MessageStrings.EXTRACTING_INVOICE_INFO;
            public function setPercentage(thePercentage:Number):void {
               var theP:Number = Math.round(thePercentage);
               this.bar.setProgress( theP, 100 );
      <mx:ProgressBar id="bar" labelPlacement="bottom" themeColor="#F20D7A"
            minimum="0" visible="true" maximum="100" label="{this.progressLabel}"
            direction="right" mode="manual" width="100%"/>
3  Announcements and General Discussion / General Discussion / notifications and thread blocking on: March 30, 2008, 01:12:33
I'm having this problem with cancelling a database operation.  When someone clicks import on a form I have I begin running through a file and inserting information into the database.  I have opened the database asynchronously so I do not block the main application thread.  I have a cancel button that people can click to cancel/rollback the import process.  The cancel event does not get broadcast immediately, and I can't really figure out why it broadcasts when it does.  It registers the click about 50 percent of the way through the database operations.  Right now I have the cancel button calling a function in the mediator which, in turn, calls a proxy function that cancels the database action.  I though maybe I needed to send another notification from the mediator (the proxy call might be deferred until the other notice finishes), but that didn't work either.  I was reading that if a notification is sent out when another notification is running that the second notification will run and then when it is completed the thread will go back to the original notification.  Is this correct?  What could I be doing wrong?  When I access the file to import, could that be blocking the notifications?
4  Announcements and General Discussion / Architecture / Database blocking Notification? on: March 18, 2008, 06:30:40
Hello.  I have an application I'm creating that uses the sqlite database.  I have one method where I am inserting quite a few rows of information into a database.  I use a few insert statements to get all the data in their correct tables.  I'm trying to output a status of how many rows have been inserted while the user waits 'cause sometimes it can take 20 seconds or so.  The problem I'm running into is that when I broadcast a notification in between inserts it is not picked up until all the inserts have happened.  I can trace out stuff in between inserts, and I even use a preliminary select statement to feed each insert statement so I know stuff is going on in between inserts.  I open the database in synchronous mode.  Does anybody know what I could be doing wrong?
5  Announcements and General Discussion / Architecture / Losing File reference in Notification body?? on: March 09, 2008, 06:17:11
I have a mediator for a form that sends a notification (body of note is event.target which is a file that has been selected) out to a command, the command relays the info to a proxy, and the proxy delegates loading of file and then returns a notification.  I keep on getting this error that says

TypeError: Error #2007: Parameter file must be non-null.
   at flash.filesystem::FileStream/open()

I'm tracing out the note.body(), throughout the process and it is good until I actually try and open the file.  Am I not casting things in the right manner, not passing info in the notification correctly? 

Here are little snippets of the process. 

In the mediator

public function fileSelected(event:Event):void {
getImportNewGameData.filePath = event.target.nativePath;
sendNotification( ApplicationFacade.IMPORT_FILE_SELECTED, [ event.target ] );

In the command
override public function execute( note:INotification ) :void   
            // Get the ImportFileProxy
            var importFileProxy:FileProxy = facade.retrieveProxy( FileProxy.NAME ) as FileProxy;


the proxy
public function loadFile(event:Object):void
// create a worker who will go get some data
// pass it a reference to this proxy so the delegate knows where to return the data
trace("This is the file name from FileProxy:"+event);
var delegate : LoadFileDelegate = new LoadFileDelegate( this );
// make the delegate do some work

and finally the helper where I'm getting the error.
public function loadGSISFile(event:Object) : void
theFile = event as File;
var stream:FileStream = new FileStream();
    stream.open(theFile, FileMode.READ);
    var fileData:String = stream.readUTFBytes(stream.bytesAvailable);
    trace("This is the file data: "+fileData);


Does anybody know what I'm doing wrong.

6  Announcements and General Discussion / Architecture / VOs and data object in Proxy on: March 08, 2008, 11:24:12
I've got this little xml database that stores user's login and password.  I have used code peek as an example of how to deal with multiple datastores using the abstractProxy.  Here is my question.  In the userProxy I have the data object set to an xmllist in the user proxy.  Should I take the additional step and create a UserVo class that is instantiated and set in the userProxy as a private variable, or is there no need to use a vo when I could return an xmllist from a get User function in the userProxy?

7  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">
            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.show(10, 50);
                myMenu.addEventListener(MouseEvent.CLICK, mainMenuClicked);
            public function mainMenuClicked(event:Event):void {
            trace("Main menu clicked");
            dispatchEvent( new Event( importGame ) );
<!-- send to Proxy JJM -->
    <!-- Define the menu data. -->
    <mx:XML format="e4x" id="myMenuData">
            <menuitem label="Import New Game Data"/>
            <menuitem label="Modify Existing Game"/>
            <menuitem label="Generate Reports"/>
            <menuitem label="Export Data"/>
<!-- call notification JJM -->
    <!-- Define a Button control to open the menu -->
        <mx:Button id="Stats"
            <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"
            click="createAndShow();" enabled="false"/>
8  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");


9  Announcements and General Discussion / Architecture / ViewStacks, Mediators and Deferred Instantiation on: February 29, 2008, 09:31:54
I've been looking through the cafe townsend demo.  I have a question.  I'm developing an app with multiple 'pages'.  It looks like the author of the project used the file ApplicationMediator to switch between view stacks.  Is this the preferred way to switch between views? 

Pages: [1]