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 / Managing Class Inheritance Across Platform-Dependent Libraries on: May 03, 2013, 11:41:40
I could use some advice on managing my class structure.  My project is quite complex -- it has five projects (all using Flex):

Desktop
Mobile
Web
CommonLib
AIRLib

About 90% of the current application functionality is in the CommonLib, with AIR API calls happening in AIRLib.  The three "display" projects kick off the STARTUP notification by doing:

:
CommonFacade.getInstance().startup(this);
Some of our Proxy classes use flash.filesystem.File functionality if available:

:
private var localData:LocalDelegate = ReflectionManager.createLocalDelegate();
private var appVO:AppVO;
public function loadAppData():void {
  if (localData) {
    appVO = localData.loadData();
  } else {
    appVO = remoteData.loadData();
  }
etc...

Currently, the Desktop and Mobile projects call something like 
:
ReflectionManager.setLocalDelegateClass(LocalFileDelegate);
This pattern has worked reasonably well so far, but I'm wondering if there isn't a better way.  I notice that we don't have *any* PureMVC-aware code in our AIRLib project, and my current task might go more smoothly if we did.

I'm getting some data from a native extension for iOS and Android that needs to be shown on a view in CommonLib.  It would be nice and simple to have that data come in on a Notification, but it doesn't cleanly fit into any existing classes in the application.
2  Announcements and General Discussion / Architecture / What's wrong with this Command? on: March 09, 2011, 08:28:21
I saw this architecture and immediately said "Whoa, that's working against the PureMVC structure!", but I can't really explain *why*, other than saying "Commands are supposed to be stateless" which isn't much more than a statement of religious doctrine ;)


public class FooCommand extends SimpleCommand {
  private var fileTransfers:Array = [];
  private var transfersComplete:int = 0;

  override public function execute(notification:INotification):void {
    //The following happens in a loop in the actual class:

    var someFile:File = new File(someLocation);
    //Logic to make sure the file exists goes here

    //FileTransfer is a helper class that wraps FileStream logic for actually reading the file
    var fileTransfer:FileTransfer = new FileTransfer(someUrl);
    fileTransfer.addEventListener(FileTransfer.TRANSFER_ERROR, this.transferError);
    fileTransfer.addEventListener(FileTransfer.TRANSFER_COMPLETE, this.transferComplete);
    this.fileTransfers.push(fileTransfer);
  }

  private function transferError(event:Event):void {
    sendNotification(MyFacade.ERROR_WITH_FILE_TRANSFER);
  }

  private function transferComplete(event:Event):void {
    //Omitted logic making sure the fileTransfers array is empty

    sendNotification(MyFacade.FILE_TRANSFERS_COMPLETE);
  }
}
3  PureMVC Manifold / MultiCore Version / Building Module-based PureMVC Multicore Projects with Ant on: February 10, 2011, 11:29:28
Are there any examples of building Flex Modules based on PureMVC Multicore on Ant?  I have a project where I'm using PureMVC Multicore for a shell/modules arrangement, with modules loaded and unloaded dynamically in the shell via ModuleManager.getModule(url);

I'm trying to build the project with Ant, but when I try to include a task to build a module, it fails with

Error: The definition of base class Facade was not found.

I'm using the following Ant target to try to build the module:

    <target name="modules">
        <mxmlc 
            file="${project.sourcePath}/${currentModule}.mxml" 
            output="${project.output.binaryPath}/${currentModule}.swf"
            actionscript-file-encoding="UTF-8"
            keep-generated-actionscript="true"
            incremental="true">
            <!-- Get default compiler options. -->
            <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
 
            <!-- List of path elements that form the roots of ActionScript
            class hierarchies. -->
            <source-path path-element="${FLEX_HOME}/frameworks"/>
 
            <!-- List of SWC files or directories that contain SWC files. -->
            <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
                <include name="libs" />
                <include name="src/assets" />
                <include name="../bundles/{locale}" />
            </compiler.library-path>
 
            <!-- Set size of output SWF file. -->
        </mxmlc>
    </target>

Any hints?
4  Announcements and General Discussion / Architecture / Inheritance in Commands on: July 16, 2010, 10:48:30
I'm working on a PureMVC Multicore application that has several Flex Modules.  There's a bunch of stuff common to all the modules, so I'm having several classes in each module inherit from base classes.

One of these base classes is a CommonStartupCommand, registered to the "startup" Notification in the CommonFacade.

Each module will have a couple of other things to start up, so I have a separate ModuleStartupCommand in each one of those, too.  Unfortunately, I can't just register that command to "startup", too; it'll replace CommonStartupCommand instead of acting in tandem with it.  At this point, I'm weighing two possible architectures to handle this:

One, the ModuleStartupCommand extends CommonStartupCommand, and the execute() function calls super.execute().

Two, implement ModuleStartupCommand as a MacroCommand, calling addSubCommand on both common and specific startup commands.

From what I've read here, option 2 seems more in line with the design philosophy of PureMVC, but option 1 seems a little simpler ... and I haven't seen *any* examples of this type of inheritance between Commands.

Got any advice for me?
5  Announcements and General Discussion / Architecture / Dynamic View Creation/Destruction on: April 15, 2008, 10:09:22
Hello,

I'm working on an app that uses a viewstack to manage multiple views.  Each view plays a background SWF (either static image or short video) and some audio.  Most of the views involve extensive interaction with the user.

With the number of views that get activated as we step through the app, we're consuming lots of memory.  To ameliorate that, we'd like to expire/unload views as the user finishes them, then reload them again when they're needed.  One thought we've had is to create all the views as separate SWFs that throw appropriate events and expose a simple API for setting any necessary data, then manage them from a Mediator.

We have a linear path through the application, so we can easily use a generational model for view components:

Parent:  Current view
Child:  Preloading resources for the next view

However, from what I've read, neither the viewstack nor view states really fit this type of model.  Does anyone have some thoughts on how this could be arranged to mesh easily with the PureMVC structure?
Pages: [1]