mWindow.addCallback()

Availability

SupportPCMacPackage (AS3) / Scope (AS2)
ActionScript 3.0

4.0

4.0

stm.mprojector.mWindow stm.mprojector.mWindowCallback

ActionScript 2.0

Usage

mWindow.addCallback(type:String, callbackFunction:Function) : Void

Parameters

type - xref=mWindowCallback.CLOSE (for versions >= 4.0.20 PC) OR name of method callable from another mProjector window.

callbackFunction

Returns

Nothing.

Description

Method; Register a function as callable by another mProejctor window from the same application OR as the mWindowCallback.CLOSE callback function. This function in not used for window to window communication in AS2. In AS2, just add the callable function to the mWindow class.

ActionScript 3.0 Example:

In this example the child defines a method, messageReceiver, to receive messages from the parent window. To make the function callable from other windows it must be associated with the windows mWindow class. In AS3 this method must be registered as an mWindow callback function using mWindow.addCallback(). In AS2 the function needs to be added to the mWindow class.

// ActionScript in child.swf
import stm.mprojector.mWindow;

// define function 
function messageReceiver (message: String):void {
	message.text = message;
};
// register messageReceiver as callable by other windows.
mWindow.addCallback("messageReceiver", messageReceiver);

// ActionScript in parent.swf
childWindow = mApplication.createWindow( "child.swf ", 50, 50,  "CHILD ",  "CHILD ",  "STANDARD ", 
	160000, true, 100, true, true,  " ");
	if (childWindow != null) {
		mApplication.trace( "childWindow:  " + childWindow.toString());
		childWindow.messageReceiver( "hello from parent ");
	}
};

ActionScript 2.0 Example:

In this example the child defines a method, messageReceiver, to receive messages from the parent window. To make the function callable from other windows it must be associated with the windows mWindow class. In AS3 this method must be registered as an mWindow callback function using mWindow.addCallback(). In AS2 the function needs to be added to the mWindow class.

// ActionScript in child.swf
mWindow.messageReceiver = function (message: String):void {
	message.text = message;
};


// ActionScript in parent.swf
childWindow = mApplication.createWindow( "child.swf ", 50, 50,  "CHILD ",  "CHILD ",  "STANDARD ", 
	160000, true, 100, true, true,  " ");
	if (childWindow != null) {
		mApplication.trace( "childWindow:  " + childWindow.toString());
		childWindow.messageReceiver( "hello from parent ");
	}
};

Code Examples

MultipleWindows

Code Examples

Window to Window Communications

viagra kaufen in der apotheke where can i buy sildenafil in the uk