3 Replies Latest reply on Jun 7, 2007 11:29 AM by d:n:k

    component background not transparent

    d:n:k
      Hi there, I have a VERY simple component I am just starting to build. The component (thus far) is just this:

      quote:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="482">
      <mx:VBox>
      <mx:Image source="@Embed('../pix/crestLogo.png')" id="logo"/>
      </mx:VBox>
      <mx:Spacer width="35" height="100%"/>
      <mx:VBox>
      <mx:Spacer width="100%" height="35"/>
      <mx:Button x="513" y="227" id="News" label="Latest News" width="125"/>
      <mx:Button x="513" y="257" id="Comnpany" label="Company" width="125"/>
      <mx:Button x="513" y="287" id="Production" label="Production" width="125"/>
      <mx:Button x="513" y="317" id="Development" label="Development" width="125"/>
      <mx:Button x="513" y="347" id="Done" label="What We've Done" width="125"/>
      <mx:Button x="513" y="377" id="Services" label="Services" width="125"/>
      <mx:Button x="513" y="407" id="Contact" label="Contact" width="125"/>
      </mx:VBox>
      </mx:HBox>


      Now when I use that in my main mxml file the background of the component is grey instead of showing the background colors of the application. I must be missing something REALLY simple. Here is the code on my main app:

      quote:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:comp="assets.components.*" layout="absolute" xmlns:components="assets.components.*">
      <mx:Style>
      Application {
      backgroundColor: #4e7ee2;
      backgroundGradientColors: #4e7ee2, #3554a6;
      themeColor: #3554a6;
      color: #3554a6;
      }
      </mx:Style>
      <comp:Menu />
      </mx:Application>



      What am I missing here? Is it a limitation, my code or a bug? When I paste the code from the component into the main app, it displays as it should.

      Ideas?
        • 1. component background not transparent
          d:n:k Level 1
          Ok, I never would have thought this was it, but it appears as though the name of my component file was the issue! My compoenent file was called Menu.mxml. I guess it is a naming/reserved name or something? At any rate, I renamed the file to MyMenu.mxml, and then called the component in my app, and problem solved. My head should stop hurting (now that I stopped pulling my hair out) anytime now....
          • 2. Re: component background not transparent
            peterent Level 2
            It is actually a classpath issue. When you named your file Menu.mxml the compiler created the class Menu. Since the local directory is searched first for components, your Menu class was loaded. Then any reference to the Flex Menu component (mx.controls.Menu) was superseded by your Menu class.
            • 3. Re: component background not transparent
              d:n:k Level 1
              Thanks for the more detailed explanation. I guess I thought that since they were in different name spaces, it never occurred to me that they would clash.