The actionscript approach for initializing defaults has a drawback – any referenced classes or assets will always be linked into the final output SWF, even if they are overridden by CSS. For simple classes and small assets, this may not be a problem; but when building up an entire theme (like the default Halo theme), it adds up.

 

Here are the basic steps for creating a CSS theme and including it in your component SWC.

 

  1. Put all defaults into a CSS file, and give the CSS file a unique name (not just ‘defaults.css’).
  2. When building the SWC, use –include-file to add the CSS file and any other required assets
  3. When building the SWC, use –include-classes to add any skin classes
  4. When using the component, make sure the SWC is added to the compiler “theme” setting. This can be done on the command line or in the config file.

 

Glenn

 


From: Gordon Smith
Sent: Tuesday, August 08, 2006 6:44 PM
To: [email protected]
Cc: Glenn Ruehle
Subject: RE: [flexcomponents] Styles :: Revisted once again

 

I think Glenn knows more about this than I do, so I've cc'd him.

 

- Gordon

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Schmalle
Sent: Tuesday, August 08, 2006 6:37 PM
To: [email protected]
Subject: Re: [flexcomponents] Styles :: Revisted once again

 

Hi Gordon,

Thanks for the clarification!

Yes, the double hit on file size makes sense, that is why I am trying to get the css file approach correct. I am having some issues with it and assets.

One other thing.

You have the defaults, how do I create something similar and 'compile it in' when I make the SWC file.

I have had no luck with the library project doing this. Embeded assets inside the css file were not getting included. In a linked directory the css file in the library project wasn't even getting recognized and compiled into the SWC.

Any thoughts?

Is there any one that could give a 'quick and dirty' procedural step process for the benefit of this list?

Peace, Mike

On 8/8/06, Gordon Smith <[EMAIL PROTECTED]com> wrote:

This approach is fine, and it's what the mx.charts classes do.

 

But for the standard Flex components, we decided to use the defaults.css approach instead. That makes it possible to restyle them easily by editing a single CSS file. Also, if they get styled in this way via autogenerated code, there is no need to have the superceded class-initialization-code-that-sets-up-styles, which adds to SWF size.

 

- Gordon

 


From: flexcomponents@yahoogroups.com [mailto:flexcompone[EMAIL PROTECTED]com] On Behalf Of Michael Schmalle
Sent: Tuesday, August 08, 2006 1:22 PM
To: flexcomponents@yahoogroups.com
Subject: [flexcomponents] Styles :: Revisted once again

 

Hi, knock knock, echo, echo

Can any Adobe peoplz tell me why

putting a variation of the following in a component class to initializes styles is bad?

        // SizerOverlay
        style = StyleManager.getStyleDeclaration ("SizerOverlay");
        if (!style)
        {
            style = new CSSStyleDeclaration();
            StyleManager.setStyleDeclaration("SizerOverlay", style, false);
        }
        if ( style.factory == null)
        {
            style.factory = function():void
            {
                this.cornerRadius = 5;
                this.fillAlpha = 1;
                this.fillColor = 0xffcc00;
                this.horizontalCursorXOffset = -9;
                this.horizontalCursorYOffset = -5;
                this.leftDiagonalCursorXOffset = -9;
                this.leftDiagonalCursorYOffset = -8;
                this.realtimeResize = true;
                this.realtimeResizeAlpha = 0;
                this.rightDiagonalCursorXOffset = -9;
                this.rightDiagonalCursorYOffset = -5;
                this.sizerAlpha = 1;
                this.sizerClientButtonRenderer = com.teotiGraphix.managers.sizerManagerClasses.SizerOverlayButton;
                this.sizerOverlayAlpha = 0;
                this.sizerOverlayOffset = true;
                this.sizerOverlaySkin = mx.skins.halo.ButtonSkin;
                this.sizerOverlayThickness = 10;
                this.verticalCursorXOffset = -9;
                this.verticalCursorYOffset = -9;
            };
        }

Since this is what the compiler actually does anyway.

Specifically,

        // SizerOverlay
        style = StyleManager.getStyleDeclaration("SizerOverlay");
        if (!style)
        {
            style = new CSSStyleDeclaration();
            StyleManager.setStyleDeclaration("SizerOverlay", style, false);
        }

I am not really agreeing with littering my classes with if() checks everywhere for default styles.

Maybe something is not thought through all the way. If I am wrong, can someone from Adobe please clarify the exact procedure for initializing default styles and skins for a commercially distributed component?

Peace, Mike


--
What goes up, does come down.




--
What goes up, does come down.

__._,_.___


SPONSORED LINKS
Custom software development Database development software Embedded software development
Offshore software development Software development


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to