The CreateObject function can create a ColdFusion component (CFC) object.
CreateObject(type, component-name)
| Parameter | Description |
|---|---|
| type |
Type of object to create.
|
| component-name |
name of a component method |
In the following example, the CFScript statements assign the tellTimeCFC variable to the tellTime component using the createObject function. The createObject function references the component in another directory. To invoke component methods, you use function syntax. For more information, see Developing ColdFusion MX Applications with CFML.
<b>Server's Local Time:</b>
<cfscript>
tellTimeCFC=createObject("component","appResources.components.
tellTime");
tellTimeCFC.getLocalTime();
</cfscript>
<br>
<b>Calculated UTC Time:</b>
<cfscript>
tellTimeCFC.getUTCTime();
</cfscript>
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6
Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt145.htm