You're trying to refer to something before it has already been defined! You're trying to use theBody
and it hasn't been created yet. You can do something like this instead:
var AvGen = {
paper: null,
theBody: {
bodies: [
[0,0,277.9,308.5,{
type:'path',
'fill': null,
'stroke':'none',
'stroke-width':'0',
'fill-opacity':'1',
'stroke-opacity':'0'
}],
],
currNr: 1,
currObj: null,
bodyColor: '#e59225'
},
init: function() {
}
}
AvGen.theBody.bodies[0][4].fill = AvGen.theBody.bodyColor;
Or even better; extract bodyColor
out completely:
var bodyColor = "#e59225";
var AvGen = {
paper: null,
theBody: {
bodies: [
[0,0,277.9,308.5,{
type:'path',
'fill': bodyColor,
'stroke':'none',
'stroke-width':'0',
'fill-opacity':'1',
'stroke-opacity':'0'
}],
],
currNr: 1,
currObj: null,
bodyColor: bodyColor
},
init: function() {
}
}