2011-05-24 53 views
0

我一直在試圖爲通用應用程序構建一個非常簡單的頁腳,當用戶將鼠標懸停在它上面並適應應用程序的寬度時,它會「增長」。這個簡單的代碼片段,似乎這樣的伎倆:包含路徑的調整大小組的問題

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" 
      currentState="normal"> 

    <fx:Script> 
      <![CDATA[ 
       import mx.events.FlexEvent; 
       private const _lipWidth:Number = 8.64; 

      ]]> 
     </fx:Script> 

     <s:states> 
      <s:State name="other"/> 
      <s:State name="normal"/> 
     </s:states> 

    <s:Group width="100%" bottom="0" rollOut="currentState = 'normal'" rollOver="currentState = 'other'"> 
     <s:Path id="LargeRibbon" x="0" bottom="0" width="100%" includeIn="other" 
       data="M {width - _lipWidth} 0 L {_lipWidth} 0 C 3.951 0 0.149 3.721 0 8.363 L 0 40 L {width} 40 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z"> 
      <s:fill> 
       <s:SolidColor color="blue"/> 
      </s:fill> 
     </s:Path> 

     <s:Path id="SmallRibbon" width="100%" x="0" y="0" includeIn="normal" 
       data="M {width - _lipWidth} 0 L 8.629 0 C 3.951 0 0.149 3.72 0 {_lipWidth} L 0 20 L {width} 20 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z"> 
      <s:fill> 
       <s:SolidColor color="gray"/> 
      </s:fill> 
     </s:Path> 
    </s:Group> 
</s:Application> 

但是,如果我嘗試將陰影添加到LargeRibbon路徑

<s:filters> 
    <s:DropShadowFilter alpha="0.15" angle="-90" blurX="2" blurY="2" distance="1" quality="2"/> 
</s:filters> 

事情停止工作 - 更具體地說,如果你啓動應用程序,將鼠標懸停在頁腳,放大應用程序,然後再將鼠標懸停在頁腳上LargeRibbon似乎不能正確調整大小。想知道爲什麼這是,一般會喜歡任何建議,你可以留心這個組/路徑組合是否有意義。

謝謝

回答

1

此代碼工作正常:

<fx:Script> 
     <![CDATA[ 
      import mx.events.FlexEvent; 
      private const _lipWidth:Number = 8.64; 

     ]]> 
    </fx:Script> 

    <s:states> 
     <s:State name="other"/> 
     <s:State name="normal"/> 
    </s:states> 

<s:Group width="100%" bottom="0" rollOut="currentState = 'normal'" rollOver="currentState = 'other'"> 
    <s:filters.other> 
     <s:DropShadowFilter alpha="0.15" angle="-90" blurX="2" blurY="2" distance="1" quality="2" /> 
    </s:filters.other> 
    <s:Path id="LargeRibbon" x="0" bottom="0" width="100%" includeIn="other" 
      data="M {width - _lipWidth} 0 L {_lipWidth} 0 C 3.951 0 0.149 3.721 0 8.363 L 0 40 L {width} 40 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z"> 
     <s:fill> 
      <s:SolidColor color="blue"/> 
     </s:fill> 
    </s:Path> 

    <s:Path id="SmallRibbon" width="100%" x="0" y="0" includeIn="normal" 
      data="M {width - _lipWidth} 0 L 8.629 0 C 3.951 0 0.149 3.72 0 {_lipWidth} L 0 20 L {width} 20 L {width} 8.489 C {width - 0.08} 3.787 {width - 3.92} 0 {width - _lipWidth} 0 Z"> 
     <s:fill> 
      <s:SolidColor color="gray"/> 
     </s:fill> 
    </s:Path> 
</s:Group> 

什麼,爲什麼它不與放置過濾器LargeRibbon工作的原因,直接我認爲它是某種類型的位圖緩存問題。