I have the following problem:
var loader = new THREE.JSONLoader( true );
model = JSON.parse(data);
var modeldata = loader.parse( jQuery.parseJSON(model['value1']) );
...
var modeldata = loader.parse( jQuery.parseJSON(model['value2']) );
...
WORKS FINE.
var loader = new THREE.JSONLoader( true );
model = JSON.parse(data);
jQueryX.each(parts, function(key, value){
var modeldata = loader.parse( jQuery.parseJSON(model[value]) );
...
});
returns 'model is undefined'
Is there a scope problem? I can not see any...
Expert advices welcome...
I am not sure about this. parts contains the list of keys (in parts[value]) that are used in model. In other words, the key of model is the value of parts.
You need to just use jQuery.parseJSON(model[key])
jQueryX.each(parts, function(key, value) {
modelData = loader.parse(jQuery.parseJSON(model[key]));
});
key
is the key by which you get the value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.