The following example shows how you can set the interpolation method on a Flex Gumbo Ellipse object’s LinearGradient fill by setting the interpolationMethod property to one of the constants in the flash.display.InterpolationMethod class.

Full code after the jump.

View MXML

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

    <ApplicationControlBar dock="true">
        <Form styleName="plain">
            <FormItem label="interpolationMethod:">
                <ComboBox id="comboBox" selectedIndex="1">
                    <dataProvider>
                        <String>{InterpolationMethod.LINEAR_RGB}</String>
                        <String>{InterpolationMethod.RGB}</String>
                    </dataProvider>
                </ComboBox>
            </FormItem>
        </Form>
    </ApplicationControlBar>

    <Graphic>
        <Ellipse id="ellipse" width="300" height="200">
            <fill>
                <LinearGradient id="linearGrad"
                        interpolationMethod="{comboBox.selectedItem}">
                    <GradientEntry color="haloOrange" />
                    <GradientEntry color="haloBlue" />
                </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.

 
Tagged with:
 
About The Author

Peter deHaan

Peter deHaan currently works for Adobe on the Flex SDK QA team. While not working on Flex, Flash, and ColdFusion applications, Peter enjoys making up bios and writing in 3rd person. Peter's rarely updated blog can be found at blogs.adobe.com/pdehaan/, actionscriptexamples.com, airexamples.com, and coldfusionexamples.com.

One Response to Setting the interpolation method for a linear gradient in Flex Gumbo

  1. greencard says:

    Is there any information about this subject in other languages?

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree