天天看点

Button控件

创建一个Button控件

<mx:Button

         id="button1"

         label="Hello world!"

/>

为Button空间嵌入图标

        Button的图标必须在编译时被嵌入。你不能在运行时引用一个Button的图标。你可以在icon属性值中使用@Embed语法来嵌入任意的GIF,JPEG,PNG,SVG或SWF文件,或者你可以绑定到一个由[Embed]元数据修饰的代码块所定义的图片。如果你必须在运行时引用Button的图像,你可以使用一个<mx:Image>标签代替<mx:Button>标签。

        如果指定了控件的图标,文字标签将在Button空间中底边居中。你可以通过labelPlacement属性指定文字标签相对于图标的位置,可选的值有right,left,bottom以及top。

<mx:Button    

         id="button1"    

         labelPlacement="bottom"    

         icon="@Embed(source='../img/feedicon_001.png')"

继续阅读