Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 382473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:11:09+00:00 2026-05-12T15:11:09+00:00

Degrafa newbie here :-). I was able to get com.degrafa.skins.CSSSkin to create linear gradient

  • 0

Degrafa newbie here :-).

I was able to get “com.degrafa.skins.CSSSkin” to create linear gradient backgrounds. Now I’m getting into more advanced stuff as I try to figure out radial gradients…

I figured this out by watching Flex-skinning-with-degrafa-screencast but my code isn’t working for me and I’m getting a white background on my canvas.

Here is the code I have so far:

I have a MXML component ThreeWayGrad.mxml which extends Canvas and has a styleName for ThreeWayGradient:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    styleName="ThreeWayGradient"/> 

I have a CSS style entry for ThreeWayGradient with a skin tag for the class RadialGradient:

Canvas.ThreeWayGradient 
{
    borderSkin: ClassReference("assets.skins.RadialGradient");
}

And finally here is the RadialGradient.mxml component:

<?xml version="1.0" encoding="utf-8"?>
<GraphicBorderSkin
 xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns="http://www.degrafa.com/2007"> 

    <mx:Script>
        <![CDATA[
            [Bindable] private var _height:Number = 0;
            [Bindable] private var _width:Number = 0;

            override protected 
                function updateDisplayList(w:Number, h:Number):void 
            {
                super.updateDisplayList(w, h);
                _height = h; 
                _width  = w;
                trace("INFO: displaylist updated --" + _height + " : " + _width );
            }
        ]]>
    </mx:Script>
     <strokes>
         <SolidStroke id="mainStroke" color="#333333" weight="3"/>
     </strokes>
        <fills>
            <RadialGradientFill    
             id="blueGradient"
             angle="45"
             focalPointRatio="0">
                <GradientStop 
                 alpha="1"
                    ratio=".25"
                    color="#ffffff"/> 
                <GradientStop 
                 alpha="1"
                    ratio=".70"
                    color="#003355"/>
                <GradientStop 
                    alpha="1"
                    ratio="1"
                    color="#111111"/>
            </RadialGradientFill>
        </fills>
        <!-- Creating the background -->
        <geometry>
         <GeometryComposition>
             <!-- Creating a Rectangle to draw the gradient to and 
             moving the center of the gradient to the lower left corner -->
             <RegularRectangle  
              fill="{blueGradient}" 
              stroke="{mainStroke}"
                 height="{_height}"
                 width="{_width}" 
                 />
         </GeometryComposition> 
        </geometry>
</GraphicBorderSkin>

Does anyone know why this isn’t working? I see the trace output with the correct sizes, so I know the class is getting called.

I also copied this code into a new Application using a Surface instead of GraphicBorderSkin element and GeometryGroup instead of GeometryComposition, and it works. Anyway I’m sure I’m missing something simple and thanks in advance!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:11:10+00:00Added an answer on May 12, 2026 at 3:11 pm

    You should be able to use skin code like this (skinWidth and skinHeight are exposed inside the GraphicBorderSkin so you don’t need to override updateDisplayList and specify additional local variables for width and height):

    <?xml version="1.0" encoding="utf-8"?>
    <GraphicBorderSkin
     xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns="http://www.degrafa.com/2007"> 
    
         <strokes>
             <SolidStroke id="mainStroke" color="#333333" weight="3"/>
         </strokes>
            <fills>
                <RadialGradientFill    
                 id="blueGradient"
                 angle="0"
                 focalPointRatio="0">
                    <GradientStop 
                     alpha="1"
                        ratio=".25"
                        color="#ffffff"/> 
                    <GradientStop 
                     alpha="1"
                        ratio=".70"
                        color="#003355"/>
                    <GradientStop 
                        alpha="1"
                        ratio="1"
                        color="#111111"/>
                </RadialGradientFill>
            </fills>
            <!-- Creating the background -->
            <geometry>
            <!-- Creating a Rectangle to draw the gradient to and 
                 moving the center of the gradient to the lower left corner -->
                 <RegularRectangle  id="rect"
                  fill="{blueGradient}" 
                  stroke="{mainStroke}"
                  height="{skinHeight}"
                     width="{skinWidth}" 
                     />
                     <!-- Alernative:   <RegularRectangle fill="{blueGradient}" stroke="{mainStroke}" height="100%" width="100%"/> -->
            </geometry>
    </GraphicBorderSkin>
    

    In this case, you don’t need a GeometryComposition enclosing the RegularRectangle. I also discussed this with Jason Hawryluk (Degrafa architect) and he pointed out the alternative way to specify via Geometry’s layout support – see the commented markup “Alternative” for the layout driven example.

    And for the Canvas, you need to specify a width and height setting for it to draw:

    <mx:Canvas 
        xmlns:mx="http://www.adobe.com/2006/mxml" width="50%" height="50%"
        styleName="ThreeWayGradient"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been learning Degrafa recently, and I have noticed that there is not much
I see a degrafa autoshape that I want to use but it seems like
I have a swc(degrafa) that I have been referencing externally in another folder on
I have a skin that's base clas is GraphicRectangularBorderSkin (from degrafa). I'm using it
I have a function that sometimes is non-differentiable at a point. When I now
I am having some issues when trying to skin the scrollbar on a horizontalList
I'd like to render to svg data in a swf at runtime (not in
I was using an mxml class but since i need to pass some properties
Is there any opensourse, free set of components for creating Flex mxml graphs? like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.