Flex 4 transparent background problem?

▼魔方 西西 提交于 2019-12-11 04:25:54

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/6258757/flex-4-transparent-background-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!