Package examples.common
Class public  class ProgressBarExample02
Inheritance ProgressBarExample02 Inheritance View

A sample of the com.teotigraphix.ui.components.ProgressBar.

Tips: Images:

160DPI


240DPI


320DPI - Notice the border and width scale with the DPI change.



Public Variables
    Variable Defined by
     
idCornerRadius : HSlider
Change the cornerRadius style.
ProgressBarExample02
     
idProgress : Button
Change the progress value.
ProgressBarExample02
     
idProgressBar : ProgressBar
The ProgressBar.
ProgressBarExample02
     
Change the progress secondary value.
ProgressBarExample02
     
idReset : Button
Resets the ProgressBar's value to 0.
ProgressBarExample02
     
idStatusPrimary : Label
Primary status text.
ProgressBarExample02
     
Secondary status text.
ProgressBarExample02
Protected Methods
    Method Defined by
     
idCornerRadius_changeHandler( event:Event ) : void
ProgressBarExample02
     
idProgressBar_completeHandler( event:ProgressBarEvent ) : void
Marks the secondary progress status complete.
ProgressBarExample02
     
idProgressBar_progressHandler( event:ProgressBarEvent ) : void
Updates the secondary progress status.
ProgressBarExample02
     
idProgressSecondary_clickHandler( event:MouseEvent ) : void
Uses setProgressSecondary() to update the ProgressBar.
ProgressBarExample02
     
idProgress_clickHandler( event:MouseEvent ) : void
Uses setProgress() to update the ProgressBar.
ProgressBarExample02
     
idReset_clickHandler( event:MouseEvent ) : void
Resets the progress status to 0.
ProgressBarExample02
Public Variable detail
idCornerRadius variable  
public var idCornerRadius : HSlider

Change the cornerRadius style.

idProgress variable  
public var idProgress : Button

Change the progress value.

idProgressBar variable  
public var idProgressBar : ProgressBar

The ProgressBar.

idProgressSecondary variable  
public var idProgressSecondary : Button

Change the progress secondary value.

idReset variable  
public var idReset : Button

Resets the ProgressBar's value to 0.

idStatusPrimary variable  
public var idStatusPrimary : Label

Primary status text.

idStatusSecondary variable  
public var idStatusSecondary : Label

Secondary status text.

Protected Method detail
idCornerRadius_changeHandler() method  
protected function idCornerRadius_changeHandler( event:Event ) : void

idProgressBar_completeHandler() method  
protected function idProgressBar_completeHandler( event:ProgressBarEvent ) : void

Marks the secondary progress status complete.

idProgressBar_progressHandler() method  
protected function idProgressBar_progressHandler( event:ProgressBarEvent ) : void

Updates the secondary progress status.

idProgressSecondary_clickHandler() method  
protected function idProgressSecondary_clickHandler( event:MouseEvent ) : void

Uses setProgressSecondary() to update the ProgressBar.

idProgress_clickHandler() method  
protected function idProgress_clickHandler( event:MouseEvent ) : void

Uses setProgress() to update the ProgressBar.

idReset_clickHandler() method  
protected function idReset_clickHandler( event:MouseEvent ) : void

Resets the progress status to 0.

Source Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
@LICENSE@
-->
<!--

ProgressBarExample02.mxml

@PROJECT_BLOCK@

-->
<!---
* A sample of the com.teotigraphix.ui.components.ProgressBar.
* 
* @title ProgressBar Sample 2
* @tip Use <code>setProgressSecondary()</code> to update the current value of progress.
* @tip Use the <code>PROGRESS</code> and <code>COMPLETE</code> events to monitor
* progress status.
* @tip Use the <code>primaryColors</code>, <code>primaryAlphas</code>, <code>secondaryColors</code>
* and <code>secondaryAlphas</code> styles to differentiate the primary and secondary progress
* bars.
* @tip Use the <code>cornerRadius</code> style to round the ProgressBar's corners.
* @source
* @mobile
* @image assets/examples/common/ProgressBarExample02_160.png 
* <strong>160DPI</strong>
* @image assets/examples/common/ProgressBarExample02_240.png 
* <strong>240DPI</strong>
* @image assets/examples/common/ProgressBarExample02_320.png 
* <strong>320DPI</strong> - Notice the border and width scale with the DPI change.
* @front
-->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:tg="http://tg.teotigraphix.com/flex4"
        title="ProgressBar Sample 2">

    <fx:Script>
        <![CDATA[
            import com.teotigraphix.ui.components.supportClasses.ProgressBarDirection;
            import com.teotigraphix.ui.events.ProgressBarEvent;
            
            /**
             * Uses setProgress() to update the ProgressBar.
             */
            protected function idProgress_clickHandler(event:MouseEvent):void
            {
                var value:Number = isNaN(idProgressBar.value) ? 0 : idProgressBar.value;
                idProgressBar.setProgress(value + 10, 100);
            }
            
            /**
             * Uses setProgressSecondary() to update the ProgressBar.
             */
            protected function idProgressSecondary_clickHandler(event:MouseEvent):void
            {
                var value:Number = isNaN(idProgressBar.secondaryValue) ? 0 : idProgressBar.secondaryValue;
                idProgressBar.setProgressSecondary(value + 10, 100);
            }
            
            /**
             * Updates the secondary progress status.
             */
            protected function idProgressBar_progressHandler(event:ProgressBarEvent):void
            {
                var label:Label = event.type == ProgressBarEvent.PROGRESS ? idStatusPrimary : idStatusSecondary;
                label.text = event.progress + "% Complete [" + event.type + "]";
            }
            
            /**
             * Marks the secondary progress status complete.
             */
            protected function idProgressBar_completeHandler(event:ProgressBarEvent):void
            {
                var label:Label = event.type == ProgressBarEvent.COMPLETE ? idStatusPrimary : idStatusSecondary;
                label.text = "Complete [" + event.type + "]";
            }
            
            /**
             * Resets the progress status to 0.
             */
            protected function idReset_clickHandler(event:MouseEvent):void
            {
                idProgressBar.setProgress(0, 0);
                idProgressBar.setProgressSecondary(0, 0);
            }
            
            protected function idCornerRadius_changeHandler(event:Event):void
            {
                idProgressBar.setStyle("cornerRadius", idCornerRadius.value);
            }
            
        ]]>
    </fx:Script>
    
    <s:layout>
        <s:VerticalLayout paddingTop="25" horizontalAlign="center"/>
    </s:layout>
    
    <!--- Change the progress value. -->
    <s:Button id="idProgress" 
              label="Set progress by 10" 
              click="idProgress_clickHandler(event)"/>
    
    <!--- Change the progress secondary value. -->
    <s:Button id="idProgressSecondary" 
              label="Set secondary progress by 10" 
              click="idProgressSecondary_clickHandler(event)"/>
    
    <!--- The ProgressBar. -->
    <tg:ProgressBar id="idProgressBar" 
                    chromeColor="#F0F0F0"
                    cornerRadius="0"
                    primaryAlphas="[0.5, 0.4]"
                    secondaryColors="[#FFCC00, #FF0000]"
                    progress="idProgressBar_progressHandler(event)"
                    complete="idProgressBar_completeHandler(event)"
                    progressSecondary="idProgressBar_progressHandler(event)"
                    completeSecondary="idProgressBar_completeHandler(event)"
                    height="25"/>
    
    <!--- Primary status text. -->
    <s:Label id="idStatusPrimary"
             text="Waiting"/>
    
    <!--- Secondary status text. -->
    <s:Label id="idStatusSecondary"
             text="Waiting"/>
    
    <!--- Resets the ProgressBar's value to 0. -->
    <s:Button id="idReset"
              label="Reset"
              click="idReset_clickHandler(event)"/>
    
    <s:Label text="Set cornerRadius"/>
    
    <!--- Change the cornerRadius style. -->
    <s:HSlider id="idCornerRadius"
               minimum="0" maximum="10"
               change="idCornerRadius_changeHandler(event)"/>
    
</s:View>
Mobile UI Toolkit1 v1.0.x Documentation - Thu Dec 15 10:21:33 EST 2011