在动态组件名称上添加子组件
由于我必须在同一表单的多个组中添加图像,因此我需要自定义我的程序来执行此操作。
确实,事实上,我有类似的东西,
if(value=="17"){
gv17.addElement(imAc);
v17.setStyle("backgroundColor",'#ffffff');
}
我的目标是做类似的事情:
if(value=="18"){
gv18.addElement(imAc);
v18.setStyle("backgroundColor",'#ffffff');
}
if(value=="17"){
gv17.addElement(imAc);
v17.setStyle("backgroundColor",'#ffffff');
}
if(value=="16"){
gv16.addElement(imAc);
v16.setStyle("backgroundColor",'#ffffff');
}
你有解决方案来解决这个问题吗? 事实上,我认为写 X 次(例如 3 次)来做到这一点是愚蠢的。我可以通过名称引用对象,因为名称是一个字符串。 我想做这样的事情:
var mytarget:string = "gv16";
mytarget.addElement(imAc);
谢谢
As I must to add image on several group on the same form, I'd to customize my procédure to do that.
Indeed, actualy, I have something like that,
if(value=="17"){
gv17.addElement(imAc);
v17.setStyle("backgroundColor",'#ffffff');
}
My goal is to do something like that:
if(value=="18"){
gv18.addElement(imAc);
v18.setStyle("backgroundColor",'#ffffff');
}
if(value=="17"){
gv17.addElement(imAc);
v17.setStyle("backgroundColor",'#ffffff');
}
if(value=="16"){
gv16.addElement(imAc);
v16.setStyle("backgroundColor",'#ffffff');
}
Do you have a solution to solve that.
Indeed, I think it's stupid to write X times (3 in example) to do that. I can refer to object by Name as name is a string.
I'd like to do something like that :
var mytarget:string = "gv16";
mytarget.addElement(imAc);
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据对象的命名方式,您可以尝试:
只要您的值编号等于符号名称编号,并且逻辑适用于每个元素,这应该可以解决您的问题,而不会变得过于复杂。
Depending on how your objects are named, you might try:
As long as your value number equates to the symbol name numbers, and the logic holds true for every element, this should solve your problem without getting overly complex.