mApplication.onRestart()

Availability

Windows: Flash 8 or 9 AS2.0 SWF + mProjector 3.0; Windows NT Support: Flash 7 SWF + mProjector 2.0 r10d;

Macintosh: Flash 8 or 9 AS2.0 SWF + mProjector 3.0;

Usage

mApplication.onRestart = function (arguments:Array) {
   // your statements here
}

Parameters

arguments - Returns the command line arguments as an array of strings.

Returns

Nothing.

Description

Event handler; An event handling function called after an attempt to start an already running application. This can used to send a message from an external application to a running mProjector application.

Example

The following code is a snippet from the mProjector builder application that loads double clicked project file (.mpr). When a user double clicks a .mpr file, Windows will launch mProjector and pass it a path to the clicked file. You can retrieve the path using the xref=mApplication.getArguments(). The argument[0] is mProjector's path, argument[1] is the path to the .mpr file. If mProjector is already open, the mApplication.onRestart() event handler is called. The "restart" command line args are passed as a parameter. How to create a file type (associate an extension with an application) http://forums.screentime.com/viewtopic.php?t=987

// Get path of a double clicked .mpr file and load it.

// case: application ljust aunched
var args:Array = mApplication.getArguments();
project.pendingNewProjectFile = args[1];
project.loadProject();

// case: application already open
mApplication.onRestart = function (args) {
    project.pendingNewProjectFile = args[1];
    project.loadProject();
    mWindow.bringToForeground();
}

stop();