| <?xml version="1.0"?> |
| <!-- |
| |
| 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. |
| |
| --> |
| <!-- Simple example to demonstrate the s:AnimateColor class. --> |
| <s:Application |
| xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| xmlns:s="library://ns.adobe.com/flex/spark"> |
| |
| <fx:Declarations> |
| <s:AnimateColor id="colorEffect" targets="{[examplePanel, targetLabel, detailText]}" |
| colorFrom="0x0000FF" colorTo="0xFF0000" repeatCount="2" repeatBehavior="reverse" |
| effectStart="playButton.enabled=false" effectEnd="playButton.enabled=true;"/> |
| <s:AnimateColor id="colorEffectBackground" colorPropertyName="borderColor" |
| target="{examplePanel}" colorFrom="0xBBBBBB" colorTo="0xFF4444" repeatCount="2" |
| repeatBehavior="reverse" effectStart="playButton.enabled=false" |
| effectEnd="playButton.enabled=true;"/> |
| </fx:Declarations> |
| |
| <s:Panel id="examplePanel" |
| title="AnimateColor Effect Example" |
| width="75%" height="75%"> |
| |
| <s:HGroup top="5"> |
| <!-- Our target to affect--> |
| <s:VGroup id="targetBox" width="50%" horizontalAlign="center"> |
| <s:Label id="targetLabel" text="Some Image" fontSize="14"/> |
| <s:BitmapImage id="targetImg" source="@Embed(source='assets/back2.png')"/> |
| </s:VGroup> |
| <s:VGroup id="detailsBox" width="50%" left="0"> |
| <s:Label id="detailText" width="99%" color="blue" |
| text="The:AnimateColor effect changes the color of a target using the following parameters: colorFrom, colorTo. Click 'Animate Color' to watch the effect."/> |
| </s:VGroup> |
| </s:HGroup> |
| |
| <s:Rect left="0" right="0" bottom="0" height="30"> |
| <s:fill> |
| <s:LinearGradient rotation="90"> |
| <s:GradientEntry color="0xE2E2E2" /> |
| <s:GradientEntry color="0xD9D9D9" /> |
| </s:LinearGradient> |
| </s:fill> |
| </s:Rect> |
| <s:Button id="playButton" |
| left="5" bottom="5" |
| label="Animate Color" |
| click="colorEffect.play();colorEffectBackground.play();"/> |
| </s:Panel> |
| </s:Application> |