Getting Started with mProjector and Flex

  1. Download and install mProjector v4.
  2. Create a new MXML application. HelloWorld
    1. In Flex Builder, select File > New> Flex Project,
      If the New Flex Project dialog box asks you to select a Flex Server Technology, select Basic, and then click Next.
      Type HelloWorld as the Project Name, and then click Finish.
      Your new project will be created and should be showing in the Navigator panel. By default the project should already contain a file named HelloWorld.mxml, and that file should be open in the Editor panel.
    2. Open the HelloWorld.mxml file, and type the following code:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" 
          layout="vertical" scriptTimeLimit="65000"
          creationComplete = "initApp()" >
          
          <mx:Script>
              <![CDATA[
                  public function initApp():void 
                  {
                      //set window title and center the application on the desktop.
                      import stm.mprojector.mWindow;
       
       
                      mWindow.setTitle("Hello mProjector");
                      mWindow.center();
                  }
              ]]>
          </mx:Script>
       
          <mx:TextArea id = "mainTxt" width="400" />        
          
      </mx:Application>
      
      To access mProjector classes and methods add an import statement stm.mprojector.mClassName then utilize the class. All mProjector classes and methods are listed in the Flash Help Panel and online in our Dev Center. In this example the initApp() function sets the window title and centers the window. Also add scriptTimeLimit="65000" to the mx:mApplication tag to avoid Flash timeout limits.
  3. Select File > Save to save the application.
  4. Add the mProjector Desktop Classes (SWC File) to your project's library path:
    • With a project selected in the Navigator view, select Project > Properties > Flex Build Path.
      Select the Library tab.
      The core library (SWC) files, such as frameworks.swc and playerglobal.swc, appear.
    • Select Add SWC.
    • Enter or browse to and select the location of the SWC file. It's installed in next to mProjector.
      Windows: C:/Program Files/mProjector 4/mprojector_flex.swc
      Mac: /Applications/mProjector 4/Flex/mprojector_flex.swc

  5. Set your "link-type" option to merger the SWC into the application SWF file when compiled:
    • With a project selected in the Navigator view, select Project > Properties > Flex Build Path.
    • Select the Library tab, and then select and expand the SWC file entry to display the SWC options.
    • Double-click the Link Type option. The Library Path Items Options dialog box appears.
    • Select the Merged into Code option, and click OK.
      This procedure is the equivalent of using the library-path compiler option.
  6. Publish your application SWF in Flex.
  7. Publish your SWF as a Desktop Application using mProjector.
    • Open mProjector.
    • Set your SWF as the main application SWF - Select mProjector's Application tab and drag-n-drop your SWF on the mProjector.
    • Set your application settings - application title, icon, window type, included files, etc.
    • Click the Build button. By default mProjector will launch your application when it's ready.