SWFLoader 的透明背景

发布于 2024-07-21 07:40:05 字数 972 浏览 3 评论 0原文

我在 SWF 中创建了一个“正在加载”微调器。 我使用 SWFLoader 在我的主应用程序 SWF 中显示此微调器。 如何使 SWFLoader 透明? 目前,即使我设置了 backgroundAlpha="0",它也使用 Flex 的默认背景颜色。

我的微调器 SWF 的主 MXML:(请注意 backgroundAlpha 的使用)

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:Controls="Controls.*" width="30" height="30" backgroundAlpha="0">
    <Controls:Spinner id="ctrlSpinner" />  <!-- spinner logic encapsulated in a component -->
</mx:Application>

我的应用程序 SWF 的主 MXML:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="801">
    <mx:SWFLoader x="10" y="173" id="swfSpinner" autoLoad="true" scaleContent="true" >
        <mx:source>SWFs/LoadingSpinnerApp.swf</mx:source>
    </mx:SWFLoader>
</mx:Application>

请注意,微调器控件本身是透明的。 SWFLoader 的一些问题导致它忽略我的 backgroundAlpha 设置。 有任何想法吗?

I created a "Loading" spinner in a SWF. I display this spinner in my main application SWF using SWFLoader. How do I make the SWFLoader transparent? Currently it uses Flex's default background color even though I've set backgroundAlpha="0".

My spinner SWF's main MXML: (Note the use of backgroundAlpha)

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:Controls="Controls.*" width="30" height="30" backgroundAlpha="0">
    <Controls:Spinner id="ctrlSpinner" />  <!-- spinner logic encapsulated in a component -->
</mx:Application>

My application SWF's main MXML:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="801">
    <mx:SWFLoader x="10" y="173" id="swfSpinner" autoLoad="true" scaleContent="true" >
        <mx:source>SWFs/LoadingSpinnerApp.swf</mx:source>
    </mx:SWFLoader>
</mx:Application>

Note that the Spinner control itself is transparent. There's just something about the SWFLoader that causes it to ignore my backgroundAlpha setting. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白衬杉格子梦 2024-07-28 07:40:05

我认为你的问题出在 Spinner 组件中,你必须在其中设置背景颜色或 alpha,这会导致你的加载程序具有背景颜色。 如果你没有设置它,那么设置它,因为它可能默认为 1 的 alpha。当我执行以下操作时,我没有得到任何背景,但当我将 alpha 更改为 1 时,会出现黑色背景。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute" backgroundAlpha="1" 
backgroundColor="#000000">
    <mx:Text id="textBox" text="Hey World"/>
</mx:Application>

<?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute" backgroundColor="#ffffff">

    <mx:Canvas backgroundColor="#ff0000" width="200" 
height="200" verticalCenter="0" horizontalCenter="0">
        <mx:SWFLoader x="10" y="173" id="swfSpinner" 
autoLoad="true" scaleContent="true" source="DebuggerTest.swf"/>
    </mx:Canvas>

    </mx:Application>

I think your problem is within the Spinner component you must be setting the background color or alpha in there and that's causing your loader to have a background color. if you not setting it then set it because it probably defaults to an alpha of 1. when I do the following I don't get any background but when I change the alpha to 1 the black background appears.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute" backgroundAlpha="1" 
backgroundColor="#000000">
    <mx:Text id="textBox" text="Hey World"/>
</mx:Application>

and

<?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute" backgroundColor="#ffffff">

    <mx:Canvas backgroundColor="#ff0000" width="200" 
height="200" verticalCenter="0" horizontalCenter="0">
        <mx:SWFLoader x="10" y="173" id="swfSpinner" 
autoLoad="true" scaleContent="true" source="DebuggerTest.swf"/>
    </mx:Canvas>

    </mx:Application>
窗影残 2024-07-28 07:40:05

事实证明,我做的是正确的事情 - Flex 只是没有将我的微调器 SWF 的最新版本复制到我的主应用程序的垃圾箱中。 相反,它一直保留在我添加透明度之前构建的先前版本。

我手动将新的微调器 SWF 复制到主应用程序的 bin,然后它就工作了!

It turns out that I was doing the correct thing -- Flex just wasn't copying the latest version of my spinner SWF to the bin of my main app. Instead it had been holding on to a previous version built before I added the transparency.

I manually copied the new spinner SWF to the main app's bin and then it worked!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文