1 Reply Latest reply on Aug 22, 2006 5:43 AM by Raheel_KSE

    Custom Accordion

      Hokay so... I'm creating a menu nav using an accordion component and have a couple questions about customizing the look.

      First Issue:
      I need each main menu item to be a different color but I can't seem to use the color property in the initObj param or by using setStyle() on the header once it's been created. I've also tried setting a global style for the label component to no avail... And I tried using a custom movie clip that was a subclass of mx.core.View which put the movie under the header despite the x and y being set to 0. Creating a custom style and setting the styleName property of the accordion worked but of course that is a global setting and I need each header to be a different color.

      import mx.core.View;
      mainMenu_acc.createChild("View", "section1", {label: "Executive Search", color: 0x9CA45D}); // doesn't work
      mainMenu_acc.section1.setStyle("color", 0x9CA45D); // doesn't work

      Second Issue:
      How do I make the text headers right justified? Saw another post on the same problem but there wasn't a resolution. The layout of the site requires the menu headers to be flush right against a block of copy. I can worry about justifying the individual menu items later What objects or classes in addition to the View class, does the accordion use to create the header text?

      Third Issue:
      After hunting through forums, web sites, LiveDocs and tomes of Official Macromedia Documentation, I cannot find one scrap on the View class other than to see that it's a subclass of UIObject and UIComponent. As a subclass of UIObject, the setStyle method should be supported and if the accordion header uses the Label class, the color property is definitely supported. Is there any other documentation or am I missing something basic? Should I use a custom theme to get the results I need or is it a lost cause?

      Last But Not Least:
      The accordion has a white background by default. Is there a way to make it transparent? The menu is positioned over a gradient so a solid color won't work without looking goofy. The accordion uses the RectBorder class to draw its background and in the documentation, it says that the background isn't drawn when the border style is set to none. In my style declaration for the accordion, I'm setting the borderStyle property to none but I still have a background. Is this an exception for the accordion component or is there another way to not have the background drawn in?

      Think that's about it... I know there's a lot here and I appreciate any help or tips you might have!! Thanks in advance...

        • 1. Re: Custom Accordion

          var style1 = new TextField.StyleSheet();

          style1.setStyle("mm", {fontFamily:'Arial,sans-serif', fontSize:'11px', color:'#6666ff'}); //internal css

          my_label.autoSize = true; /// -------- already created a label (my_label) instance --------
          my_label.styleSheet = style1;
          my_label.html = true;
          my_label.text = "<mm> My Sub menu1</mm>";