[Flex]在TextArea中嵌入圖像

TextArea的htmlText支持多種html標簽,如<a>、<b>、<br>、<font>、<img>等,這裏使用<img>標簽來將圖片嵌入到TextArea中~~<img>標簽可用于嵌入JPEG,GIF,PNG及SWF等媒體文件到文本框中,文本會自動分佈到嵌入圖像的週圍,註意隻有支持多行(multiline)及自動換行(warp)的動態或輸入文本框才支持<img>標簽~~

默認情況下Flash將嵌入的媒體以其原始呎吋顯示,若要指定媒體的大小,可使用<img>標簽的height和width屬性~~以下系<img>標簽所支持的屬性:

src    GIF,JPEG,PNG或SWF文件的路徑;此屬性必須賦值,其他的都是可選的;外部文件要加載完畢才會顯示出來

align    圖像的水平對齊方式 ( left / right ),默認為left

height    圖像的高度(pixels)

hspace    圖像邊緣与文字的水平間隔,默認值為8

id    圖像的id

vspace    圖像邊緣与文字的垂直間隔,默認值為8

width    圖像的寬度(pixels)

 

  1. <?xml version="1.0"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundGradientColors="[#FFFFFF,#FFFFFF]" width="300" height="300">
  3.     <mx:Text height="100%" width="100%">
  4.         <mx:htmlText>
  5.             <![CDATA[
  6.                 <p>You can include an image in your HTML text width the <img>tag.</p><p><img src='../assets/bird.gif' width='30' height='30' align='left' hspace='10' vspace='10'>Here is text that follows the image.I'am extending the text by lengthening this sentence until it'long enough to show warpping around the bottom of the image.</p>
  7.         </mx:htmlText>
  8.     </mx:Text>
  9. </mx:Application>
  10. 文章来自: 闪客居(www.flashas.net) 详文参考:http://www.flashas.net/html/flex/20071111/2448.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值