mApplication.createObject()

Availability

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

Macintosh: Not Applicable

Usage

mApplication.createObject(classId:String) : Object

Parameters

classId - A string containing the object class id.

Returns

An object.; ; Returns a COM object, exposing most of its methods and properties.

Description

Method; Creates the specified COM object. When no longer needed, the object should be destroyed using the deleteObject() method. When specifying the classId, either the object class name or class id can be used. Both COM object methods and properties can be accessed through ActionScript. Simple properties, such as the EOF property of the Recordset object in the above example, can be accessed directly. However, the array properties such as the Fields collection in the above example have to be accessed via the getProperty function, and set via the setProperty function.

Example

The following example creates a COM object, calls one of its methods, and deletes it when finished. Note that, when no longer needed, each COM object should be explicitly deleted using its deleteObject() method.

var c = NULL;
c = mApplication.createObject("Foo.dll");
if (c)
{
    c.doSomething();
    c.deleteObject();
    c = NULL;
}

See Also

mApplication.registerCOMServer()

Code Examples

Windows COM Basics, Windows COM MS Access Database