Link to home
Start Free TrialLog in
Avatar of cassiej81
cassiej81

asked on

How to delay a flex application ?

Hi, i'm building a flex application now, in my program i need to pause it about 2-3 seconds to wait something display.Please tell me how can i achieve it?

Thanks in advance!
Avatar of Gary Benade
Gary Benade
Flag of South Africa image

You could it with modal popups, but here is how to do it with states
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" currentState="wait">
        <mx:states>
                <mx:State name="wait">
                        <mx:AddChild position="lastChild">
                                <mx:Canvas width="200" height="200" backgroundColor="#FFFFFF">
                                        <mx:Label y="92" text="Wait 3 sec" horizontalCenter="-1"/>
                                </mx:Canvas>
                        </mx:AddChild>                        
                </mx:State>
        </mx:states>
        <mx:Script>
        	<![CDATA[
        		private function init():void
        		{
        			this.enabled = false;
        			setTimeout( reenable, 3000);
        		}
        		private function reenable():void
        		{
        			currentState = null;
        			this.enabled = true;
        		}
        	]]>
        </mx:Script>    
</mx:Application>

Open in new window

Avatar of cassiej81
cassiej81

ASKER

Thanks hobbit, but is there anyway to do it?Exactly what i want is pause about 1 second on each "for" loop?So would you please tell me how can i do it?
ASKER CERTIFIED SOLUTION
Avatar of Gary Benade
Gary Benade
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks hobbit!