content/tourdeflex/spark/fxg/LinearGradientsSpreadMethodExample.mxml (5 lines of code) (raw):

<?xml version="1.0" encoding="utf-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo"> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; ]]> </fx:Script> <s:Panel title="LinearGradient Control" width="100%" height="100%" > <s:HGroup horizontalCenter="0" top="10"> <s:Label verticalAlign="justify" x="10" y="30" width="200" text="The LinearGradient class lets you specify the fill of a graphical element, where a gradient specifies a gradual color transition in the fill color. You add a series of GradientEntry objects to the LinearGradient object's entries Array to define the colors that make up the gradient fill."/> <s:Rect id="rect1" height="150" width="160" > <s:fill> <s:LinearGradient id="gradient1" scaleX="20" x="0"> <s:entries> <s:GradientEntry color="0xFF0000" /> <s:GradientEntry color="0xFFFFFF" /> <s:GradientEntry color="0x0000FF" /> </s:entries> </s:LinearGradient> </s:fill> </s:Rect> <s:VGroup> <s:Label text="scaleX value: " /> <s:HSlider id="scaleXVal" value="20" maximum="200" change="gradient1.scaleX=scaleXVal.value"/> <s:Label text="x value: " /> <s:HSlider id="XVal" value="0" maximum="200" change="gradient1.x=XVal.value"/> <s:Label text="select a spreadMethod: " /> <s:DropDownList id="spreadValue" selectedIndex="0" dataProvider="{new ArrayCollection(['pad', 'reflect', 'repeat'])}" change="gradient1.spreadMethod=spreadValue.selectedItem"/> </s:VGroup> </s:HGroup> </s:Panel> </s:Application>