Getting Started with the PureMVC Startup Manager - Introduction

This three-parts tutorial reflects my own learning experience with the PureMVC framework and the PureMVC Startup Manager. It was inspired by Philip Sexton’s demo Startup as Ordered and is my first attempt on PureMVC. The tutorial’s goal is to provide beneficial information to other novice PureMVC users who have understood the theory but lack practice.

Here’s a short overview of the tutorial’s content:

Part 1

  1. Preparing the Project Space
  2. The Resource Files: styles.css and data.xml

Part 2

  1. The StartupMonitorProxy
  2. The StartupResourceProxy
  3. “Loaded” and “Failed” Notifications
  4. Updating the Project Space
  5. The ApplicationFacade
  6. The StartupCommand
  7. The Resource Proxies

Part 3

  1. Preparing the View
  2. The StageMediator
  3. Testing the Demo
  4. Conclusion

I closed the comments sections of the three tutorial parts. If you want to discuss the tutorial please add your comments to this introductory post. You can download the sample files from here (the ZIP archive includes a FlashDevelop project file).

And now let’s get started…

Tags: , , ,

15 Responses to “Getting Started with the PureMVC Startup Manager - Introduction”

  1. Cliff Hall Says:

    Stefan,

    Thanks for this concise and informative introduction to the StartupManager utility. It is something every PureMVC app needs, and now everyone will have a much easier time understanding how to use it.

    I hope you don’t mind, I’ve added a Tutorial link on the StartupManager site pointing directly to this introduction: http://trac.puremvc.org/Utility_AS3_StartupManager

    -=Cliff>

  2. Michal Says:

    Hi,

    Thanks for this, sounds very clear and concise. One thing though, I cannot get it to run in FlexBuilder3. Could you please provide additional instructions on how your tutorial can be run in FlexBuilder3 please?
    Thanks!

    Michal

  3. Stefan Schmalhaus Says:

    Michal, rename the “lib” folder to “libs” because this is where FB3 expects the SWC files.

  4. Michal Says:

    Thank you for that Stefan.
    I have done that earlier, but it’s not working. What seems to be the problem in FB3 is that the Main class is not initialising. And if I do something like
    var m:Main=new Main(); in my mxml file after it’s completed creating, I get an error:
    Error #1009: Cannot access a property or method of a null object reference.
    where the extended ’stage’ object in Main.as is ‘null’ at the time of execution.
    Sorry I should’ve made myself clearer in my previous post.

    Thank you
    Michal

  5. Stefan Schmalhaus Says:

    Michal, no need for MXML here at all, it’s a pure AS3 project. I originally set up the project in FlashDevelop, but I’ve just recreated it in FB3, and it works.

    1. Create an “ActionScript Project” in FB3.
    2. Select “src” as your source folder and “bin” as your output folder.
    3. Import the folders/files from my ZIP archive.
    4. Make sure that the “Main.as” file is set as default application.

    Now for the SWCs. FB3 scans the “libs” folder for SWCs only if it is a Flex project. I didn’t remember that when I wrote my first comment. In an ActionScript project you have to add the “lib”/”libs” folder as a “SWC Folder” manually. Go into the project properties, select “ActionScript Build Path” -> “Library Path” -> “Add SWC Folder” and choose your “lib”/”libs” folder.

    Run the project in debug mode so that you can see the trace() messages in the output panel (console).

    Here’s a screenshot of my FB3 setup:
    http://blog.log2e.com/wp-content/uploads/2008/05/startup_manager_demo_fb3_setup.gif

  6. Michal Says:

    Thank you for that Stefan,
    It worked great. I see now my mistake was trying to set this up as a Flex/AIR application. Which I did figure out eventually, using the default mxml file and call from there to facade.startup(this) rather than using the Main.as file.
    Nice work on the tutorial and thanks again for all your help here.

    Michal

  7. Oliver Says:

    Hi Stefan,

    Many thanks for this very helpfull tutorial.

    But I am encountering some difficulties when trying to test the project:

    StartupCommand.as, Line 22 1119: Access of possibly undefined property defaultTimeout through a reference with static type org.puremvc.as3.utilities.startupmanager.model:StartupMonitorProxy.

    The defaultTimeout property does not exist in the StartupMonitorProxy.as file…

    StageMediator.as, Line 28 1119: Access of possibly undefined property LOAD_RESOURCES_REJECTED through a reference with static type Class.

    StageMediator.as, Line 51 1119: Access of possibly undefined property LOAD_RESOURCES_REJECTED through a reference with static type Class.

    The LOAD_RESOURCES_REJECTED constant does not exist in the StartupMonitorProxy.as file…

    Thanks for your help…
    Best regards,

  8. More PureMVC Links « The Algorithmist Says:

    [...] PureMVC Startup Manager. [...]

  9. FlashDevelop - OpenSource alternative for Flex Builder | Rich Internet Applications Says:

    [...] behind FB, but in most cases it has everything you need! For persons who are interested in PureMVC, here is a short tutorial how use it with [...]

  10. Stefan Schmalhaus Says:

    @Oliver: Which version of the Startup Manager utility do you use? The tutorial is based on version 1.2. Please note that the 1.3 release breaks backward compatibility with the previous release. More information here: http://trac.puremvc.org/Utility_AS3_StartupManager/wiki/ReleaseNotes

  11. Justin Ho Says:

    @Oliver:

    Change to:
    _monitor.defaultRetryPolicy = new RetryPolicy(new RetryParameters(0, 0, 30)); in StartupCommand

    Remove
    case StartupMonitorProxy.LOAD_RESOURCES_REJECTED: from handleNotification

    Remove StartupMonitorProxy.LOAD_RESOURCES_REJECTED, from handleNotification

  12. Pascal Says:

    Great tutorial !

    First, I’m French and my english is bad. Sorry.

    I’m looking for conrete tutorials that explain PureMVC with pure AS3.
    I have understood the theory but I need à “real world” exemple.
    Bye…

    Pascal.

  13. FlashDevelop - OpenSource alternative for Flex Builder | Enetlive.net- Rich Internet Applications Blog Says:

    [...] persons who are interested in PureMVC, here is a short tutorial how use it with [...]

  14. jim Says:

    Great tutorial
    But in trying to compile in the IDE keep getting the following error
    1119: Access of possibly undefined property defaultTimeout through a reference with static type org.puremvc.as3.utilities.startupmanager.model:StartupMonitorProxy.

  15. cim Says:

    great tutorial ..

    in the StartupCommand from the downloaded files you have lines 27 and 28 commented out , but in the tutorial you still refer to these lines, as casting to IStartupProxy.

    don’t know which one is correct ?

Leave a Reply