<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:controls="com.keunster.controls.*" layout="absolute" creationComplete="{ onCreationComplete( event ) }" viewSourceURL="srcview/index.html"> <mx:Style source="assets/styles.css" /> <mx:Script> <![CDATA[ import com.keunster.utils.ColorUtilClasses.Color; import com.keunster.controls.AnimatingGradientClasses.AnimatingGradientMeta; private function onCreationComplete( event : Event ) : void { animatingGradient.addEventListener( AnimatingGradient.EVENT_FINISHED, doGradientAnimation, false, 0, true ); doGradientAnimation(); } private function doGradientAnimation( event : Event = null ) : void { var meta : AnimatingGradientMeta = new AnimatingGradientMeta(); meta.alphas = [ 1, 1, 1 ]; meta.durationSteps = 50; meta.fillColors = [ Math.random() * 0xffffff, Math.random() * 0xc7c7c7, Math.random() * 0xffffff ]; meta.gradientAngle = Math.round(Math.random() * 360 ); meta.ratios = [ Math.random() * ( 50 ) , Math.random() * ( 127 - 100 ) + 120, Math.random() * ( 255 - 200 ) + 200 ]; meta.gradientType = GradientType.LINEAR; animatingGradient.beginGradientAnimation( meta ); } ]]> </mx:Script> <controls:AnimatingGradient id="animatingGradient" width="100%" height="100%" styleName="animatedBackground" /> </mx:Application>