Setting the origin X and Y coordinate for a linear gradient fill in Flex Gumbo

The following example shows how you can set the origin X and Y coordinate for a linear gradient fill in Flex Gumbo by setting the x and y properties on the LinearGradient object.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/11/30/setting-the-origin-x-and-y-coordinate-for-a-linear-gradient-fill-in-flex-gumbo/ -->
<Application name="LinearGradient_x_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <ApplicationControlBar dock="true">
        <Form styleName="plain">
            <FormItem label="x:">
                <HSlider id="xSlider"
                        minimum="-100"
                        maximum="100"
                        value="0"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true" />
            </FormItem>
            <FormItem label="y:">
                <HSlider id="ySlider"
                        minimum="-100"
                        maximum="100"
                        value="0"
                        snapInterval="1"
                        tickInterval="25"
                        liveDragging="true" />
            </FormItem>
            <FormItem label="rotation:">
                <HSlider id="rotationSlider"
                        minimum="-360"
                        maximum="360"
                        value="0"
                        snapInterval="1"
                        tickInterval="45"
                        liveDragging="true" />
            </FormItem>
        </Form>
    </ApplicationControlBar>

    <Graphic>
        <Ellipse id="ellipse" width="300" height="200">
            <fill>
                <LinearGradient id="linearGrad"
                        x="{xSlider.value}"
                        y="{ySlider.value}"
                        rotation="{rotationSlider.value}">
                    <GradientEntry color="red" />
                    <GradientEntry color="white" />
                    <GradientEntry color="blue" />
                </LinearGradient>
            </fill>
        </Ellipse>
    </Graphic>

</Application>

View source is enabled in the following example.

This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.