2015-05-25 59 views
0

我相信這一定很簡單,但我看不到它。Flex RadioButton皮膚透明背景允許鼠標點擊通過

我已經創建了一個RadioButton的皮膚,它基本上是一個正方形的組,裏面有一個三角形。三角形的尖端位於廣場的中心。所有的作品都是矢量路徑,並在MXML中定義。

當我在我的用戶界面中定位RadioButton時,它們彼此重疊,儘管可見的三角形沒有。

當我單擊RadioButton時,我無法點擊最頂層的RadioButtons的透明區域到下面的RadioButtons的三角形圖形。任何人都可以建議我哪裏錯了?

這是當前Skin文件:

<s:Skin 
     xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     alpha.disabledStates="0.5"> 

    <fx:Metadata> 
    <![CDATA[ 
    /** 
    * @copy spark.skins.spark.ApplicationSkin#hostComponent 
    */ 
    [HostComponent("spark.components.RadioButton")] 
    ]]> 
    </fx:Metadata> 

    <fx:Script> 
    <![CDATA[ 
    /** 
    * @private 
    */ 
    private static const focusExclusions:Array = ["labelDisplay"]; 

    /** 
    * @private 
    */ 
    override public function get focusSkinExclusions():Array { return focusExclusions;}; 
    ]]> 
    </fx:Script> 

    <s:states> 
    <s:State name="up" /> 
    <s:State name="over" stateGroups="overStates" /> 
    <s:State name="down" stateGroups="downStates" /> 
    <s:State name="disabled" stateGroups="disabledStates" /> 
    <s:State name="upAndSelected" stateGroups="selectedStates" /> 
    <s:State name="overAndSelected" stateGroups="overStates, selectedStates" /> 
    <s:State name="downAndSelected" stateGroups="downStates, selectedStates" /> 
    <s:State name="disabledAndSelected" stateGroups="disabledStates, selectedStates" /> 
    </s:states> 

    <!-- Main artwork Group defining scale --> 
    <s:Group 
      scaleX="0.175" scaleY="0.175"> 

    <s:Group 
      width="1024" height="1024"> 

     <!-- Up Artwork --> 
     <s:Group 
       id="viewpointUp" 
       excludeFrom="selectedStates"> 

     <s:Path id="BeamDisabled" x="183.549" y="31.3008" winding="nonZero" data="M0 0 328.451 480.698 656.902 0"> 
      <s:fill> 
      <s:LinearGradient x="328.452" y="480.698" scaleX="480.698" rotation="270"> 
       <s:GradientEntry ratio="0" color="#BFBFBF"/> 
       <s:GradientEntry ratio="0.570107" color="#EBEBEB" alpha="0.429893"/> 
       <s:GradientEntry ratio="1" color="#FFFFFF" alpha="0"/> 
      </s:LinearGradient> 
      </s:fill> 
     </s:Path> 
     <s:Ellipse id="SpotDisabledEllipse" x="477" y="477" width="70" height="70"> 
      <s:fill> 
      <s:SolidColor color="#BFBFBF"/> 
      </s:fill> 
      <s:stroke> 
      <s:SolidColorStroke weight="8" miterLimit="10" color="#FFFFFF"/> 
      </s:stroke> 
      <s:filters> 
      <s:GlowFilter blurX="16" blurY="16" quality="2" color="#000000" alpha="0.25"/> 
      </s:filters> 
     </s:Ellipse> 
     </s:Group> 

     <!-- Up and Selected Artwork --> 
     <s:Group 
       id="viewpointSelected" 
       includeIn="selectedStates"> 

     <s:Path id="BeamEnabled" x="183.549" y="31.3008" winding="nonZero" data="M0 0 328.451 480.698 656.902 0"> 
      <s:fill> 
      <s:LinearGradient x="328.452" y="480.698" scaleX="480.698" rotation="270"> 
       <s:GradientEntry ratio="0" color="#14948B"/> 
       <s:GradientEntry ratio="0.29695" color="#6FBDB8" alpha="0.70305"/> 
       <s:GradientEntry ratio="0.570107" color="#B6DEDB" alpha="0.429893"/> 
       <s:GradientEntry ratio="0.815192" color="#E9F5F4" alpha="0.184808"/> 
       <s:GradientEntry ratio="1" color="#FFFFFF" alpha="0"/> 
      </s:LinearGradient> 
      </s:fill> 
     </s:Path> 
     <s:Ellipse id="SpotEnabledEllipse" x="477" y="477" width="70" height="70"> 
      <s:fill> 
      <s:SolidColor color="#14948B"/> 
      </s:fill> 
      <s:stroke> 
      <s:SolidColorStroke weight="8" miterLimit="10" color="#FFFFFF"/> 
      </s:stroke> 
      <s:filters> 
      <s:GlowFilter blurX="16" blurY="16" quality="2" color="#000000" alpha="0.25"/> 
      </s:filters> 
     </s:Ellipse> 
     </s:Group> 
    </s:Group> 
    </s:Group> 

    <!-- Label --> 
    <!--- @copy spark.components.supportClasses.ButtonBase#labelDisplay --> 
    <s:Label id="labelDisplay" 
      textAlign="start" 
      verticalAlign="middle" 
      maxDisplayedLines="1" 
      left="18" right="0" top="3" bottom="3" verticalCenter="2" /> 
</s:Skin> 

回答

0

問題可能是與X和你在你的皮膚文件中指定的y值。當您將這些皮膚應用於單選按鈕時,x值= 183和y = 33將不起作用,因爲單選按鈕在實際應用中會佔用很小的空間。

的x和y值必須是橢圓

零點和現在刪除x和y的路徑也並設置horizo​​ntalCenter = 0和verticalCenter = 0

和如果可能的話指定最小寬度和高度以橢圓和路徑也確保路徑寬度應該小於橢圓的路徑寬度

希望這項工程

+0

在視覺上一切都很好。該作品在Illustrator中創建並導出爲FXG,然後調整爲MXML文件,這就是爲什麼它具有x和y值來將「路徑」定位到「組」中。這些RadioButton中的4個在我的用戶界面2中使用的是最重要的,彼此分開,當點擊工作時很好,所以我認爲這些作品不是問題。 – TDC

+0

無法理解你的問題。您能否請您發佈示例代碼或您如何定位單選按鈕的圖片? –