Flex as中设置组件属性
时间:2011-03-09 来源:吗啉
Flex的组件,如LinkButton
在mxml中设置属性时,可有
<mx:LinkButton label="百度" fontSize="12" textDecoration="underline" fontWeight="normal" icon="@Embed(source='icons/icon_attachment.gif')" click="gotoLink()"/>
但是,如果在as中 var newLink:LinkButton=new LinkButton();
newLink不可以直接设置textDecoration或icon等属性
应该设置类型:
var newLink:LinkButton=new LinkButton(); newLink.setStyle("icon",linkBicon); newLink.label=ac_links[i].name; newLink.setStyle("fontSize",12); newLink.name=ac_links[i].value; newLink.setStyle("textDecoration","underline"); newLink.addEventListener(MouseEvent.CLICK,gotoLink);
相关阅读 更多 +