PDA

View Full Version : Object "on demand"



mpp
01-20-2010, 06:27 AM
Hello everyone,

I have 95 different objects like this one:



obj1Object = {
name: "some name",
type: "type",
picid: "001",
maxvl: 500000,
minvl: 5000,
clsid: 1,
movable: true,
size: [45, 45],
note: "Some text here"
}


Now what I need is to access these objects only when I need then. Right now they all load when accessing my program so all 95 of them are "somewhere" in memory. Hope that makes sense. Thanks for your time.

bdl
01-20-2010, 06:39 AM
What's the criteria / event for loading an object? In other words, if you were to use an array to store each object name, what would trigger that object to load?

mpp
01-20-2010, 07:26 AM
What's the criteria / event for loading an object? In other words, if you were to use an array to store each object name, what would trigger that object to load?

Well, right now it's in external file. Looks like:

obj1Object = {
.... stuff....
}
obj2Object = {
.... stuff....
}

etc...

And I have different functions to display or return different stuff:


function displayObjectsInfo(objId){

this.objectid = objId;

$("infobox").innerHTML = "This object is: " + this.objectid.name + " type: " + this.objectid.type;

}
displayObjectsInfo(obj1Object);

Philip M
01-20-2010, 08:55 AM
AJAX


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.