I’m working through the demo projects in the SDK and was hoping someone could shed more light on the CreateObject() method? In the Reference Manual it simply says it “creates a BrightScript Component of class name specified”, which doesn’t really tell me much as it seems integral to BrightScript as it’s used often.
Is there somewhere else that describes the proper use of CreateObject() somewhere? Specifically, the String that you give it, what is that? Is it random ad-hoc based on developers design time naming or do you have to follow a certain set standard of values? For example, if I create foo = CreateObject(“roWhateverIWant”), will this do anything?
Also, it seems you can pass it optional parameters, where are these defined and what do they do??
Basically, is there a better description on how to use CreateObject() than what’s outlined in the Reference Manual?
The components you can create are detailed in the “Core Brightscript Components” section of the BrightScript reference, and in the ComponentReference.pdf. Any optional parameters are defined in the specific component documentation. You cannot create your own components, so only intrinsic BrightScript component names are valid for CreateObject().
“jbrave” wrote:
Create object is like the DIM statement in other languages
Not exactly. BrightScript actually has it’s own DIM statement (just like VB/VBScript). CreateObject() is the way to create the object that you’re going to assign to a DIM’d variable. In fact, it’s pretty much identical to the VBScript function of the same name: http://msdn.microsoft.com/en-us/library … 85%29.aspx