2011-06-06 102 views
2

我發現了幾種解決方案,但這些解決方案都不適用於我。請有人幫我解決這個問題。 這裏是我的代碼:Flex 4透明背景問題?

<?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" name="app_clock" 
       minWidth="150" minHeight="150" width="150" height="150" backgroundAlpha="0.0"> 


       <fx:Script> 
     <![CDATA[ 

     ]]> 
    </fx:Script> 
    <fx:Declarations> 
    </fx:Declarations> 

       <s:Graphic id="clock_graphics"> 
     <s:Ellipse width="90" height="90" x="5" y="5"> 
      <s:stroke> 
       <s:LinearGradientStroke weight="50" rotation="60"> 
        <s:entries> 
         <s:GradientEntry color="#B5B5B5">       
         </s:GradientEntry> 
         <s:GradientEntry color="#494949">       
         </s:GradientEntry> 
        </s:entries> 
       </s:LinearGradientStroke> 
      </s:stroke> 
     </s:Ellipse>  
     </s:Graphic> 

</s:Application> 

而且我在JS設置這個params.wmode = "transparent";和對象

<param name="bgcolor" value="transparent" /> 
<param name="wmode" value="transparent" /> 

是否anybode有工作的解決方案? Tnx提前。

+0

你到底需要修正什麼?你提到了你已經嘗試過的幾種解決方案,它們是什麼?請記住,並非每個網頁瀏覽器都以相同的方式處理透明度,例如大多數Linux瀏覽器不能使用Flash透明度。 – Kyle 2011-06-06 22:34:39

+0

@Kyle我不知道在Linux上不能工作,沒關係,我只需要firefox,chrome和explorer :),我想要透明背景。所以橢圓圖形有一些顏色,一切(背景),我想透明,如果你在谷歌上鍵入Flex 4透明背景,你會看到我嘗試過什麼,我不是flex開發人員,也許我做錯了什麼,tnx提前,對不起我的英語不好。 – user147 2011-06-06 22:40:18

+0

爲什麼不簡單地將alpha設置爲0工作? – Kyle 2011-06-06 22:48:48

回答

5

'Backgroundalpha'將不起作用。您需要創建一個自定義透明應用程序皮膚類。事情是這樣的:

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

<fx:Metadata> 
    [HostComponent("spark.components.Application")] 
</fx:Metadata> 

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

<s:Rect id="backgroundRect" left="0" right="0" top="0" bottom="0"> 
    <s:fill> 
     <s:SolidColor alpha="0" /> 
    </s:fill> 
</s:Rect> 

<s:Group id="contentGroup" left="0" right="0" top="0" bottom="0" 
     minWidth="0" minHeight="0" /> 

</s:Skin> 

並將其分配給您的應用程序:

<s:Application ... skinClass="MyTransparentApplicationSkin" ... /> 

我測試過的所有主要瀏覽此解決方案。 (是的,那包括Safari)

此外,<param name="bgcolor" value="transparent" />會對你沒有好處。它只會使用十六進制顏色代碼。

+0

好吧,tnx,讓我先看看如何創建應用程序皮膚。而且會測試它的工作。 – user147 2011-06-06 22:46:29

+0

heyyyyyy,它正在工作,tnx老兄:) – user147 2011-06-06 22:50:51

+0

非常感謝您的解決方案。工作就像一個魅力:) – ufk 2014-09-02 12:14:33