<?xml version="1.0" encoding="utf-8"?> <!-- //////////////////////////////////////////////////////////////////////////////// // // *Copyright (c) 2007 // // The usual Yada-Yada! // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this code and associated documentation // files (the "Code"), to deal in the Code without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Code is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Code. // // THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // // Further it is worth to mention that no animals have been // harmed during the development. No trees have been cut // down. Womens rights have been treated with full respect. // Mankind's safety has been ensured at every step. // // Peace! // // @file: AutoRefresher // @author: Uday M. Shankar // @original author: Easwar Natarajan // @date: 31-03-2007 // @description: Sample implementation of AutoRefresher. // //////////////////////////////////////////////////////////////////////////////// --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="initView()" xmlns:flexed="flexed.utils.*" backgroundGradientColors="[#004080, #8080ff]"> <mx:Script> <![CDATA[ private var dt:Date = new Date(); //Getting the current time and setting it to the label. //Starting the Autorefresher private function initView():void{ lblTime.text = dt.toUTCString(); exampleAutoRefresh.start(); } //Function to execute on each autorefresh. private function rfrshTime():void{ dt = new Date(); lblTime.text = dt.toUTCString(); } ]]> </mx:Script> <flexed:AutoRefresher id="exampleAutoRefresh" delay="3000" refreshFunction="rfrshTime"/> <mx:Canvas width="80%" height="77" horizontalCenter="0" verticalCenter="0" backgroundColor="#ffffff" borderColor="#000080" borderStyle="solid" borderThickness="2" cornerRadius="6"> <mx:Label id="lblTime" text="Label" fontFamily="Times New Roman" fontWeight="normal" fontSize="36" width="100%" horizontalCenter="0" verticalCenter="0" textAlign="center" color="#e67300"/> </mx:Canvas> </mx:Application>