I have a JavaScript object, and I need some of the properties to reference values of other properties. Namely, I have a button that I want to sit relative to the parent panels position at all times, this is what I tried:
var main_panel_obj = {
id: 'mainPanel',
component: 'Window',
draggable: false,
padding: 4,
position: { x: 0, y: 0 },
width: gW*.04,
height: gH,
layout: [1, 3],
children: [
{
id: 'btnWater',
component: 'Button',
skin: 'bluebutton',
position: { x: this.position.x, y: this.position.y+20 }, // x,y from line 6
width: gW * 0.03,
height: gH * 0.03
}
]
};
How do I get the child button's position to refer to the parent's panel pos?