A
andy_w_irvine
Hi,
Apologies if this has been asked elsewhere, I did search but expect I
didn't hit on the required terminology.
I want to be able to use a string variable called objectName
(original!) to get a reference to an instance of my object
courseObject - created using the following code.
function courseObject(courseName,sectionX,sectionY,layer){
this.courseName=courseName;
this.sectionX=sectionX;
this.sectionY=sectionY;
this.layer=layer;
this.updateLocation=updateLocation;
this.updateLayer=updateLayer;
}
+ simple methods
objectName gets its value from the following section(comes from a drag
and drop API that provides the name of the element that was last
dragged)
objectName= dd.obj.name
There is an object created for each element of the drag & drop
interface. I want to use the string objectName to get a reference to
the object with the name the string contains. To be used in this
fashion.
objectName.updateLocation(section,day)
But as objectName is a string rather than a reference to the object it
will not work. Sure there is a simple solution but I am missing it. Any
help much appreciated.
Apologies if this has been asked elsewhere, I did search but expect I
didn't hit on the required terminology.
I want to be able to use a string variable called objectName
(original!) to get a reference to an instance of my object
courseObject - created using the following code.
function courseObject(courseName,sectionX,sectionY,layer){
this.courseName=courseName;
this.sectionX=sectionX;
this.sectionY=sectionY;
this.layer=layer;
this.updateLocation=updateLocation;
this.updateLayer=updateLayer;
}
+ simple methods
objectName gets its value from the following section(comes from a drag
and drop API that provides the name of the element that was last
dragged)
objectName= dd.obj.name
There is an object created for each element of the drag & drop
interface. I want to use the string objectName to get a reference to
the object with the name the string contains. To be used in this
fashion.
objectName.updateLocation(section,day)
But as objectName is a string rather than a reference to the object it
will not work. Sure there is a simple solution but I am missing it. Any
help much appreciated.