您好,欢迎来到我要学flash网!登录注册

Flex 4中如何给Panel设置bitmap填充背景色的例子

来源:我要学flash网 | 作者:admin | 发表时间:2012-02-04 | 点击:  次

接下来的例子演示了Flex 4中如何通过BitmapFill和LinearGradient,给Panel设置bitmap填充背景色。
 

  1. <?xml version="1.0" encoding="utf-8"?>   
  2. <s:Application name="Spark_Panel_fill_BitmapFill_test"   
  3.         xmlns:fx="http://ns.adobe.com/mxml/2009"   
  4.         xmlns:s="library://ns.adobe.com/flash.com/article/flex' target='_blank'>flex/spark"   
  5.         xmlns:mx="library://ns.adobe.com/flash.com/article/flex' target='_blank'>flex/halo">   
  6.     
  7.     <mx:ApplicationControlBar width="100%" cornerRadius="0">   
  8.         <mx:Form styleName="plain">   
  9.             <mx:FormItem label="rotation:">   
  10.                 <s:HSlider id="rotationSlider"   
  11.                         minimum="-360"   
  12.                         maximum="360"   
  13.                         value="90"   
  14.                         liveDragging="true"   
  15.                         width="{pnl.width}" />   
  16.             </mx:FormItem>   
  17.             <mx:FormItem label="ratio:">   
  18.                 <s:HSlider id="ratioSlider"   
  19.                         minimum="0.0"   
  20.                         maximum="1.0"   
  21.                         value="0.2"   
  22.                         valueInterval="0.05"   
  23.                         liveDragging="true"   
  24.                         width="{pnl.width}" />   
  25.             </mx:FormItem>   
  26.         </mx:Form>   
  27.     </mx:ApplicationControlBar>   
  28.     
  29.     <s:Panel id="pnl"   
  30.             title="Spark Panel title"   
  31.             width="320" height="240"   
  32.             horizontalCenter="0" verticalCenter="0">   
  33.         <s:Rect width="100%" height="100%">   
  34.             <s:fill>   
  35.                 <s:BitmapFill source="@Embed('assets/pattern_140.gif')" />   
  36.             </s:fill>   
  37.         </s:Rect>   
  38.         <s:Rect width="100%" height="100%">   
  39.             <s:fill>   
  40.                 <s:LinearGradient rotation="{rotationSlider.value}">   
  41.                     <s:GradientEntry color="white"   
  42.                             alpha="0.0"   
  43.                             ratio="0.0" />   
  44.                     <s:GradientEntry color="#F0EBD2"   
  45.                             alpha="1.0"   
  46.                             ratio="{ratioSlider.value}" />   
  47.                 </s:LinearGradient>   
  48.             </s:fill>   
  49.         </s:Rect>   
  50.         <s:TextArea id="textArea"   
  51.                 verticalScrollPolicy="on"   
  52.                 left="20" right="20"   
  53.                 top="20" bottom="20">   
  54.             <s:text>The quick brown fox jumps over the lazy dog.</s:text>   
  55.         </s:TextArea>   
  56.     </s:Panel>   
  57.     
  58. </s:Application> 

 

    顶一下
    (0)
    0%
    踩一下
    (0)
    0%
    本文引用地址:
      最新评论: 共有位网友发表了评论
      发表评论:
    请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
    评价:
    表情:
    用户名: 密码: 验证码: