Flex as中设置组件属性

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);

posted @ 2011-03-09 14:01  xngeer  阅读(968)  评论(0编辑  收藏  举报