简体   繁体   中英

Flex 4 transparent background problem?

I have found several solutions for this,but non of those solutions work for me.Can someone help me with this please. here is my code:

<?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>

And I have setup in js to this params.wmode = "transparent"; and in object

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

Does anybode have a solution that work? Tnx in advance.

'Backgroundalpha' won't work. You'll need to create a custom transparent application skin class. Something like this:

<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>

and assign it to your Application:

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

I've tested this solution on all major browsers. (Yes, that includes Safari)

Furthermore, <param name="bgcolor" value="transparent" /> will do you no good. It will only take color hex codes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM