Transparent background for SWFLoader
In SWF I have created a Load counter. I am showing this counter in my main SWF application using SWFLoader. How do I make the SWFLoader transparent? It currently uses Flex's default background color even though I have set backgroundAlpha="0"
.
My spinner SWF main MXML: (Note the usage 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 SWF main MXML application:
<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 itself is transparent. There is something about the SWFLoader that makes it ignore the backgroundAlpha settings. Any ideas?
a source to share
Turns out I was doing the right thing - Flex just didn't copy the latest version of my spinner SWF to the trash bin of my main app. Instead, it was holding on to the previous version created before I added transparency.
I manually copied the new spinner SWF to the main container of the application and then it crashes!
a source to share
I think your problem is the Spinner component that you have to set a background color or alpha and that your loader will have a background color. if you haven't installed it, install it because it probably defaults to alpha 1. When I do the following, I don't get any background, but when I change the alpha to 1, a 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>
a source to share