mApplication.sendMessage()

Availability

Windows: Flash 8 or 9 AS2.0 swf + mProjector 3.1.0

Macintosh: Not Yet Available

Usage

mApplication.sendMessage(applicationName:String, message:String) : Void

Parameters

applicationName - Name of the target mProjector application.

message - Message to send.

NOTE: The message will be received as space delimited array of strings much like a command line arguments (mApplication.getArguments()). Sending "hello from app 1" will be received as the array [hello, from, app, 1].

Returns

Nothing.

Description

Method; Sends a message to another mProjector application. This call will trigger the event handler mApplication.onMessage() in the target application.

Example

This sample sends the message "hello from app1" to an application named app2.

appName_ti.text = "app2";
message_ti.text = "hello from app1";
receive_ti.text = "----";

send_btn.onPress = function() {	
	mApplication.trace("sending message");
	mApplication.sendMessage(appName_ti.text, message_ti.text);
}
mApplication.onMessage = function(args:Array) {
	mApplication.trace("received message");
	receive_ti.text = args.join(" ");
}

See Also

mApplication.onMessage()

Code Examples

http://www.screentime.com/downloads/mp/code/sendMessage.zip