Basic mProjector ActionScript

The mProjector classes follow ActionScript (AS) syntax. Flash "code completion" and "function parameter tips" make it easy to write mProjector code.

Sample mProjector ActionScript

To center your application's window on the the primary monitor add the mProjector command mWindow.center() to your ActionScript.

// Sets window position to the center of the primary monitor
mWindow.center();

To add the ability to minimize your window by clicking your own custom minimize button, add the mProjector command mWindow.minimize() to the button's onPress event handler.

// Minimize button 
minimize_btn.onPress = function() { 
     mWindow.minimize(); 
}

To make your window draggable, add a drag brag in the form of a button or movieclip and add mWindow.startDrag() to it's onPress event handler. Dragging stops automatically when the user releases the mouse or when you call mWindow.stopDrag()

// Draggable window frame 
window_frame_mc.onPress = function () { 
     mWindow.startDrag(); 
}

To enable the user to quit the application, you can add a quit button and call mApplication.quit() in it's onPress event handler.

// Quit button
quit_btn.onPress = function() {  
     mApplication.quit(); 
} 

NOTE: mProjector commands have no effect when the SWF is played by the Flash player. mProjector commands become effective once the SWF is compiled into an application with the mProjector compiler -- see Step (4).

More mProjector ActionScript...

mApplication.enableAutoTrace(true);  // Tells mProjector to trace all commands.
mWindow.setZOrder("STANDARD"); // Sets window ZOrder behavior to normal
mWindow.setTitle("Basic Application"); // Sets window application and window title
mApplication.showOnTaskBar(true); // Adds a button in the Windows taskbar for the application.
mApplication.trace("initialization complete"); // trace message

mProjector documentation is available in the Flash Help panel and online -- sorted by class and alphabetical order.

To find the mProjector documentation in Flash, open the Help panel, select the "Help" tab, open the Help Contents pane by clicking the arrow on the left-most window border of the Help panel, and scroll the Contents pane until you see the "mProjector" book.

Check out our Application Basics sample to see a simple example of mProjector code in action. Go to Online Samples for more code.