<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/12/02/setting-the-spread-method-on-a-linear-gradient-fill-in-flex-gumbo/ -->
<Application name="LinearGradient_spreadMethod_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <Script>
        <![CDATA[
            import mx.events.ListEvent;
            import mx.events.SliderEvent;

            private function comboBox_change(evt:ListEvent):void {
                var value:String = comboBox.selectedItem.toString();
                linearGrad.spreadMethod = value;
            }

            private function widthSlider_change(evt:SliderEvent):void {
                ellipse.width = evt.value;
            }

            private function scaleXSlider_change(evt:SliderEvent):void {
                linearGrad.scaleX = (scaleXCheckBox.selected) ? NaN : evt.value;
            }

            private function scaleXCheckBox_change(evt:Event):void {
                linearGrad.scaleX = (scaleXCheckBox.selected) ? NaN : scaleXSlider.value;
            }
            
            private function rotationSlider_change(evt:SliderEvent):void {
                linearGrad.rotation = evt.value;
            }
        ]]>
    </Script>

    <Declarations>
        <Array id="arr">
            <String>{SpreadMethod.PAD}</String>
            <String>{SpreadMethod.REFLECT}</String>
            <String>{SpreadMethod.REPEAT}</String>
        </Array>
    </Declarations>

    <ApplicationControlBar dock="true">
        <Form styleName="plain">
            <FormItem label="spreadMethod:">
                <ComboBox id="comboBox"
                        dataProvider="{arr}"
                        change="comboBox_change(event);" />
            </FormItem>
            <FormItem label="width:">
                <HSlider id="widthSlider"
                        minimum="100"
                        maximum="500"
                        value="300"
                        labels="[100,300,500]"
                        snapInterval="1"
                        tickInterval="50"
                        liveDragging="true"
                        change="widthSlider_change(event);" />
            </FormItem>
            <FormItem label="scaleX:" direction="vertical">
                <HSlider id="scaleXSlider"
                        minimum="100"
                        maximum="500"
                        value="300"
                        labels="[100,300,500]"
                        snapInterval="1"
                        tickInterval="50"
                        liveDragging="true"
                        change="scaleXSlider_change(event);" />
                <CheckBox id="scaleXCheckBox"
                        label="NaN:"
                        labelPlacement="left"
                        selected="true"
                        change="scaleXCheckBox_change(event);" />
            </FormItem>
            <FormItem label="rotation:">
                <HSlider id="rotationSlider"
                        minimum="-360"
                        maximum="360"
                        value="0"
                        snapInterval="1"
                        tickInterval="45"
                        liveDragging="true"
                        change="rotationSlider_change(event);" />
            </FormItem>
        </Form>
    </ApplicationControlBar>

    <Graphic>
        <Ellipse id="ellipse"
                width="300"
                height="200">
            <fill>
                <LinearGradient id="linearGrad">
                    <GradientEntry color="red" />
                    <GradientEntry color="white" />
                    <GradientEntry color="blue" />
                </LinearGradient>
            </fill>
        </Ellipse>
    </Graphic>

</Application>