The following example shows how you can pause the indeterminate animation in a Flex ProgressBar control by setting the mode property to “polled” or “manual”. You can resume the animation by setting the mode back to “event”.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/10/31/pausing-the-animation-in-an-indeterminate-progressbar-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:ApplicationControlBar dock="true">
        <mx:Form>
            <mx:FormItem label="mode:">
                <mx:ComboBox id="comboBox">
                    <mx:dataProvider>
                        <mx:Array>
                            <mx:Object label="event" />
                            <mx:Object label="polled" />
                            <mx:Object label="manual" />
                        </mx:Array>
                    </mx:dataProvider>
                </mx:ComboBox>
            </mx:FormItem>
            <mx:FormItem label="indeterminate:">
                <mx:CheckBox id="checkBox" selected="true" />
            </mx:FormItem>
        </mx:Form>
    </mx:ApplicationControlBar>

    <mx:ProgressBar id="progressBar"
            indeterminate="{checkBox.selected}"
            mode="{comboBox.selectedItem.label}" />

</mx:Application>

View source is enabled in the following example.

 
Tagged with:
 
About The Author

Peter deHaan

Peter deHaan currently works for Adobe on the Flex SDK QA team. While not working on Flex, Flash, and ColdFusion applications, Peter enjoys making up bios and writing in 3rd person. Peter's rarely updated blog can be found at blogs.adobe.com/pdehaan/, actionscriptexamples.com, airexamples.com, and coldfusionexamples.com.

3 Responses to Pausing the animation in an indeterminate ProgressBar control

  1. Mirko says:

    Thank a lot for this tip, i was just thinking about this few days ago but couldn’t find ProgressBar property that would allow pausing animation :)

  2. Alison says:

    Thanks for this information, I’ve been looking for something to help me with the animation issues I’m having, glad I found it, so yeah thank you very much.

  3. Ugo Ducharme says:

    I too had animation issue as my progress bar is uses in both determinate and indeterminate mode. Thanks to you, my problem is solved quickly.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree