我只是想从 After Effects ScriptUI API 创建一个包含多个控件的对象。
这就是我的 obj 的样子:
var easeyPeasy = {};
// groups
easeyPeasy.groups = {
"easeIn_grp": ease__Panel.add('group', undefined, {
name: 'easeIn group'
}),
"easyEase_grp": ease__Panel.add('group', undefined, {
name: 'easyEase group'
}),
"easeOut_grp": ease__Panel.add('group', undefined, {
name: 'easeOut group'
})
};
// labels
easeyPeasy.label = {
"easeIn_label": easeyPeasy.groups["easeIn_grp"].add('statictext', undefined, 'ease in:', {
name: 'easeIn_label'
}),
"easyEase_label": easeyPeasy.groups["easyEase_grp"].add('statictext', undefined, 'easy ease: ', {
name: 'easyEase_label'
}),
"easeOut_label": easeyPeasy.groups["easeOut_grp"].add('statictext', undefined, 'ease out:', {
name: 'easeOut_label'
})
};
// slider
easeyPeasy.slider = {
"easeIn_slider": easeyPeasy.groups["easeIn_grp"].add('slider', undefined, 50, 0, 100, {
name: 'easeIn_slider'
}),
"easyEase_slider": easeyPeasy.groups["easyEase_grp"].add('slider', undefined, 50, 0, 100, {
name: 'easyEase_slider'
}),
"easeOut_slider": easeyPeasy.groups["easeOut_grp"].add('slider', undefined, 50, 0, 100, {
name: 'easeOut_slider'
})
}
// inputs
easeyPeasy.inputs = {
"easeIn_input": easeyPeasy.groups["easeIn_grp"].add('edittext', undefined, 50, {
name: 'easeIn_input'
}),
"easyEase_input": easeyPeasy.groups["easyEase_grp"].add('edittext', undefined, 50, {
name: 'easyEase_input'
}),
"easeOut_input": easeyPeasy.groups["easeOut_grp"].add('edittext', undefined, 50, {
name: 'easeOut_input'
})
}
如果我知道尝试返回length
我easeyPeasy.inputs
的示例,我只会得到undefined
alert(easeyPeasy.inputs.length)
除此之外,我无法通过键索引在我的 obj 中选择值。它只能通过密钥字符串工作。
在职的:
alert(easeyPeasy.inputs["easeIn_input"])
不工作:
alert(easeyPeasy.inputs[0])
有谁知道我在这里想念什么?提前致谢