I have a web service that returns a url to display a new weather image
inside of a panel.  I am trying to write in a fade effect in my result
handler for the web service, and I cannot seem to get them to run in
sequence, it seems like they are all running overlapping on
themselves.  I want the current image to fade out, have the webservice
get the new image, and then fade the new image in.  

I have created a <mx:Fade with all my settings, bound to {imgWeather},
my mx:image object.  I have a timer that, every 15 seconds, triggers a
web service call.  In my web-service result handler, I tried
fadeOut.play(), handle my result, fadeIn.play(), but the yall jumble
together.  Is there an easier way to make this work properly?

Chris Peterson

(for those who are a glutton for punishment, here is my code, its not
too big)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*"
layout="absolute" creationComplete="init()" frameRate="60"
width="100%" height="100%" paddingLeft="0" paddingRight="0">

<mx:WebService wsdl="webservices.cfc?wsdl" id="ws" showBusyCursor="false">
        <mx:operation name="getMarquee" result="doMarquee(event)" />
        <mx:operation name="getImage" result="doImage(event)">
                <mx:request>
                        <currentImage>{imgWeather.source}</currentImage>
                </mx:request>                   
        </mx:operation>
</mx:WebService>

<mx:Script>
        <![CDATA[
                import mx.rpc.events.ResultEvent;
                import flash.utils.Timer;
                
                [Bindable]
                public var marqueeResults:String = ' ';
                public var timer:Timer = new Timer( 15000, 0);
                
                public function doMarquee(event:ResultEvent):void {
                marqueeResults = event.result.toString();
                }
                
                public function doImage(event:ResultEvent):void {
                
                imgWeather.source = event.result.toString();
                fadeIn.play();
                }
                
                // initialize all base data into the form
                private function init():void {
                        // Initialize our marquee values from the web service
                        ws.getMarquee.send();
                        ws.getImage.send();
                        // init our timer object and setup listeners for it     
                
                        timer.addEventListener(TimerEvent.TIMER, timedEvents);
                        timer.start();
                }
                
                private function timedEvents(event:TimerEvent):void {
                        ws.getImage.send();                     
                        switch (timer.currentCount) {
                                // Reset timer once we hit 10 minutes
                                case 40:
                                        marqueeResults = '';
                                        ws.getMarquee.send();
                                        timer.reset();
                                        timer.start();
                                        break;
                        }
                }
        ]]>
</mx:Script>

<mx:Fade duration="2000" id="fadeOut" target="{imgWeather}"
alphaFrom="1.0" alphaTo="0.0" suspendBackgroundProcessing="true" />
<mx:Fade duration="2000" id="fadeIn" target="{imgWeather}"
alphaFrom="0.0" alphaTo="1.0" suspendBackgroundProcessing="true" />

        <mx:HBox width="100%" left="10" top="10">
                <mx:Panel width="634" height="455" layout="absolute"
id="panelWeather" title="Us Weather" horizontalAlign="center"
verticalAlign="middle" fontWeight="bold" fontFamily="Verdana"
fontSize="14" backgroundColor="#000000">
                        <mx:Image autoLoad="true" width="100%" 
scaleContent="true"
id="imgWeather" horizontalCenter="3.5" verticalCenter="0.5" source="" />
                </mx:Panel>
                <mx:Panel width="100%" height="100%" paddingTop="0"
layout="absolute" id="panelMessage" title="Message from Me"
fontSize="14" fontFamily="Verdana" backgroundColor="#000000">
                        <mx:Canvas width="100%" height="100%" top="0" 
autoLayout="true">
                                <mx:TextArea width="100%" height="100%" 
verticalCenter="0" top="0"
id="text_message" wordWrap="true" color="#ffffff"
backgroundColor="#000000" borderColor="#000000" fontSize="16"
editable="false" enabled="true">
                                        <mx:htmlText>
                                                <![CDATA[                       
                                
                                                        <p><img src="me.jpg" 
align="right" hspace="5" vspace="5" /><BR
/><B>Greetings!</B><BR />enter random inspirational message</p>
                                                        <img src="sig.gif" 
align="right" />
                                                ]]>
                                        </mx:htmlText>
                                </mx:TextArea>
                        </mx:Canvas>
                </mx:Panel>
        </mx:HBox>
        <Marquee fontSize="40" id="myMarquee" fontFamily="Verdana"
fontWeight="bold" color="White" text="{marqueeResults}" bottom="10"
left="10" width="1004"/>
</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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> 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