We’ve looked at this briefly in a previous entry, but here’s a quick look at each of the five options for the ProgressBar.labelPlacement property.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/08/positioning-a-label-within-a-progress-bar-using-the-progressbarlabelplacement-property/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Label text="ProgressBar.labelPlacement" />
    <mx:HBox>
        <mx:VBox>
            <mx:RadioButtonGroup id="rbg" />
            <mx:RadioButton label="left" group="{rbg}" />
            <mx:RadioButton label="center" group="{rbg}" />
            <mx:RadioButton label="right" group="{rbg}" />
            <mx:RadioButton label="top" group="{rbg}" />
            <mx:RadioButton label="bottom" group="{rbg}" />
        </mx:VBox>
        <mx:VBox backgroundColor="white"
                horizontalAlign="center"
                verticalAlign="middle"
                width="200" height="100%">

            <mx:ProgressBar id="progressBar"
                    barColor="haloOrange"
                    label="{rbg.selectedValue}"
                    labelPlacement="{rbg.selectedValue}"
                    mode="manual"
                    width="150"
                    creationComplete="progressBar.setProgress(50, 100)" />

        </mx:VBox>
    </mx:HBox>

</mx:Application>

View source is enabled in the following example.

 
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.

2 Responses to Positioning a label within a progress bar using the ProgressBar.labelPlacement property

  1. Niks says:

    Hi there , i have been usually going through your applications. its really amazing work.
    I have some query regarding Progress Bar.

    I have created a FLV player with Play, Start, End and Stop Buttons.

    Where start is starting point and end is ending point. After Assigning these both points ,play the video u will just have that much duration video.
    The Progress Bar Progressively increasing with the video.

    Now when i press start button. i need to show a point on Progress Bar or need to change color of Progress Bar when Start Point assigned. so user can know this is start point .

    same with the end point .

    Please have look on this query

    Thanks in Advance
    Niks

  2. vinod says:

    Hi,

    Is there a way to place the progress bar control within a Data Grid column ? i need to show the progress of each row in the data grid.
    Appreciate your help

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