I've cleaned it up a little - and rectified my main mistake - after 
reading some more documentation I've set the defaults in the 
constructor.

I've not yet been able to figure out how to have those defaults 
present in the design view, yet. So, any help would be appreciated.

This is my updated code,

package xmx.comps {
        import mx.containers.Panel;
        import flash.util.trace;

        public class Panel extends mx.containers.Panel {

                public function Panel() {
                        super();
                        layout="absolute";
                        setStyle("backgroundAlpha", 0.3);
                        setStyle("backgroundColor", 0xFFFFFF);
                        setStyle("borderAlpha", 1);
                        setStyle("borderColor", 0xFFFFFF);
                        setStyle("borderStyle", "solid");
                        setStyle("borderThickness", 1);
                        setStyle("borderThicknessBottom", 0);
                        setStyle("borderThicknessLeft", 0);
                        setStyle("borderThicknessRight", 0);
                        setStyle("borderThicknessTop", 2);
                        setStyle("color", 0x333333);
                        setStyle("cornerRadius", 0);
                        setStyle("fontSize", 10);
                        setStyle("headerColors", [0xFFFFFF, 
0xBBBBBB]);
                        setStyle("headerHeight", 21);
                        setStyle("highlightAlphas", [1,1]);
                        setStyle("dropShadowEnabled", true);
                        setStyle("titleStyleName", "fontBodyB");
                }
        }
}

and the MXML is as follows,

<xmxComps:Panel x="9" y="9" width="234" height="474" id="panelTest" 
title="Panel Test">
<xmxComps:Button x="3" y="3" label="Button"/>
</xmxComps:Panel>

--- In [email protected], "grae_hall" <[EMAIL PROTECTED]> wrote:
>
> I've created a series of extended visual components for the project 
> I'm currently working on so I've got a centralised location to 
adjust 
> the appearance and methods of any component I put on the stage.
> 
> So for example, I have XPanel, which extends Panel, and I've 
> overridden commitProperties to set a series of defaults such as 
> borderThickness, etc.
> 
> It seems to work fine when I run the application, but none of the 
> defaults appear in Design View. The component can be dragged onto 
the 
> stage etc, but the properties that appear in the Design View are 
the 
> Flex defaults, not the new defaults I've set.
> 
> Where or how exactly do I set the properties within the extended 
> class to enable Design View to pick them up and display them?
> 
> Here's an example,
> 
> package xmx.comps {
>       import mx.containers.Panel;
>       import flash.util.trace;
>       import mx.states.SetStyle;
> 
>       public class XPanel extends Panel {
> 
> 
>               public function XPanel() {
>                       super();
>                       var className:String="XPanel";
>               }
> 
>               override protected function commitProperties():void {
>                       layout="absolute";
>                       setStyle("cornerRadius", 0);
>                       setStyle("headerHeight", 24);
>                       setStyle("borderThicknessBottom", 0);
>                       setStyle("borderThicknessLeft", 0);
>                       setStyle("borderThicknessRight", 0);
>                       setStyle("borderThicknessTop", 0);
>                       setStyle("borderThicknessTop", 0);
>                       setStyle("headerColors", [0xFFFFFF, 
> 0xFFFFFF]);
>                       setStyle("highlightAlphas", [1,1]);
>                       setStyle("backgroundAlpha", 0.3);
>                       setStyle("backgroundColor", 0xFFFFFF);
>                       setStyle("dropShadowEnabled", true);
>                       setStyle("shadowDirection", "right");
>                       setStyle("shadowDistance", 1);
>                       super.createChildren();
>               }
>       }
> }
> 
> and the MXML that instances it is as follows,
> 
>               <xmxComps:XPanel x="9" y="9" width="234" height="474" 
> id="panelTest">
>               </xmxComps:XPanel>
> 
> It appears as expected when the application is run, but it looks 
like 
> a standard Flex panel in Design View.
> 
> Is there a simple fix, or am I doing something horrendously 
incorrect?
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to