Thank you for your help.  I managed to get a timer function written, 
but everytime the timerEvent runs it blanks out the display.

The page loads and displays the weather and then calls the 
timerExample every second (for testing).  But each time the 
TimerEvent runs the weather data displays, but disapears just as 
soon as it displays. While the timer is counting to the next event 
the weather does not display.  Then after it's complete it leaves 
the display blank.

Below is the entire code.  I would be greatful for any suggestions.  
Maybe its the datagrid, just not sure.

David

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute" width="490" height="56" 
backgroundGradientColors="[#ffffff, #ffffff]" 
creationComplete="initVars()" horizontalAlign="center" 
verticalAlign="middle" borderColor="#ff0000" 
backgroundColor="#ffffff" borderStyle="solid" borderThickness="1">
            <mx:Script>
        <![CDATA[
                        import mx.logging.LogEvent;
                        /* import flash.events.MouseEvent;
                        import mx.events.FlexEvent; */
                        import mx.styles.CSSStyleDeclaration;
                        import mx.utils.ArrayUtil;
                import mx.effects.*;
                        import mx.events.*;
                import mx.rpc.events.*;
                        import mx.managers.PopUpManager;
                        import flash.events.Event;
                    import flash.events.TimerEvent;
                    import flash.utils.Timer;
            import flash.net.*;

                    [Bindable]          
                public var mylocID:String;

                    // Assign values to new properties.
                private function initVars():void {
                                InitApp();
                        //      ShortTimer();
                }
            public function InitApp():void
                        {       
                                // assign values passed from the 
html object flashvars
                                mylocID = 
Application.application.parameters.mylocID;
                                // if no value passed from the html 
object tag then assign value
                                if (mylocID == null) {
                                        mylocID = "29223";
                                }
                                // get weather
                                weatherSvc.qryCurrentWeather
(lbmylocid.text);
                                weatherSvc.qryExtendedWeather
(lbmylocid.text);
                        
                                // set focus on the first row of the 
grids
                                dgCurrentWeather.selectedIndex = 0;
                                dgExtendedWeather.selectedIndex = 0;
                                TimerExample();
                        }

        public function TimerExample() {
            var myTimer:Timer = new Timer(1000, 5);
            myTimer.addEventListener("timer", timerHandler);
            myTimer.start();
        }

        public function timerHandler(event:TimerEvent):void {
                        // get weather
                        weatherSvc.qryCurrentWeather(lbmylocid.text);
                        weatherSvc.qryExtendedWeather
(lbmylocid.text);               
        }

                        
         ]]>
    </mx:Script>

        <mx:RemoteObject id="weatherSvc" destination="ColdFusion" 
source="Widgets.cfc.widgets" showBusyCursor="true" />
        
    <!-- Declare a formatter and specify formatting properties. -->
    <mx:DateFormatter id="StandardDateFormat" 
formatString="MM/DD/YYYY @ L:NN A"/>
    <!-- holds the current weather -->
        <mx:DataGrid visible="false" height="50" width="50" 
id="dgCurrentWeather" 
dataProvider="{weatherSvc.qryCurrentWeather.lastResult}" />
    <!-- holds the extended weather -->
        <mx:DataGrid visible="false" height="50" width="50" 
id="dgExtendedWeather" 
dataProvider="{weatherSvc.qryExtendedWeather.lastResult}" />    
        
        <mx:ViewStack x="5" y="-2" id="vsWeather" width="483" 
height="56" selectedIndex="0">
                <mx:Canvas label="Current" id="CurrentView" 
width="493" height="58">
                    <mx:Label id="lbmylocid" visible="false" 
text="{mylocID}" />
                        <mx:Label x="-3" y="-1" text="WEATHER" 
id="WeatherLabel" fontSize="13" fontWeight="bold" color="#ff8000"/>
                        <mx:Label id="conditions" 
text="{StandardDateFormat.format
(dgCurrentWeather.selectedItem.CurrentDate)}" x="-1" y="18" 
fontSize="11"/>
                        <mx:Label x="-2" y="35" text="UV Index: 
{dgCurrentWeather.selectedItem.uvIndex}" id="uvIndex" 
color="#ff0000" fontSize="11"/>
                        <mx:Image x="141" y="2" id="WeatherIcon" 
source="images/32x32/{dgCurrentWeather.selectedItem.icon}" 
width="32" height="32"/>
                        <mx:Label x="179" y="16" 
text="{dgCurrentWeather.selectedItem.temp} F" id="temp" 
fontWeight="bold" fontSize="12"/>
                        <mx:Label x="179" y="33" 
text="{dgCurrentWeather.selectedItem.conditions}" id="Conditions"/>
                        <mx:Label x="180" y="2" text="CURRENTYLY:"/>
                        <mx:Label x="308" y="2" text="Hi:"  
height="18"/>
                        <mx:Label x="334" y="2" 
text="{dgExtendedWeather.selectedItem.hi} F" id="currentHi" 
fontWeight="bold"/>
                        <mx:Label x="308" y="17" text="Low:" />
                        <mx:Label x="334" y="17" 
text="{dgExtendedWeather.selectedItem.low} F" id="currentLo" 
fontWeight="bold"/>
                        <mx:Label x="385" y="9" text="Feels Like: 
{dgCurrentWeather.selectedItem.feelsLikeTemp} F" id="FeelsLike" 
fontWeight="bold" color="#ff0000"/>
                        <mx:Button x="347" y="32" label="Extended 
Weather" id="btnCurrent" 
click="vsWeather.selectedChild=ExtendedView;"/>
                </mx:Canvas>
                <mx:Canvas label="Extended" id="ExtendedView" 
width="483" height="56">
                        <mx:HBox verticalAlign="top" 
horizontalGap="20">
                                <mx:Repeater id="repExtended" 
dataProvider="{weatherSvc.qryExtendedWeather.lastResult}">
                                        <mx:VBox verticalGap="-6" 
horizontalAlign="center">
                                                <mx:Label 
text="{repExtended.currentItem.DayofWeek}" />
                                                <mx:Image width="32" 
height="32" source="images/32x32/
{repExtended.currentItem.partDicon}" />
                                                <mx:Label 
text="{repExtended.currentItem.hi}/{repExtended.currentItem.low}" />
                                        </mx:VBox>              
                        
                                </mx:Repeater>                  
        
                        </mx:HBox>
                        <mx:Button x="356" y="32" label="Current 
Weather" id="btnExtended" 
click="vsWeather.selectedChild=CurrentView;"/>
                </mx:Canvas>
        </mx:ViewStack>
</mx:Application>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to