Package examples.toolkit1
Class public  class RatingBarExample01
Inheritance RatingBarExample01 Inheritance View

A sample of the RatingBar component.

Tips: Author:

Michael Schmalle
Copyright:

Teoti Graphix, LLC
Images:


Public Variables
    Variable Defined by
     
idRatingBar : RatingBar
RatingBarExample01
     
idRatingBar2 : RatingBar
RatingBarExample01
     
idSnapInterval : CheckBox
RatingBarExample01
Protected Methods
    Method Defined by
     
button1_clickHandler( event:MouseEvent ) : void
RatingBarExample01
     
idSnapInterval_changeHandler( event:Event ) : void
RatingBarExample01
Public Variable detail
idRatingBar variable  
public var idRatingBar : RatingBar

idRatingBar2 variable  
public var idRatingBar2 : RatingBar

idSnapInterval variable  
public var idSnapInterval : CheckBox

Protected Method detail
button1_clickHandler() method  
protected function button1_clickHandler( event:MouseEvent ) : void

idSnapInterval_changeHandler() method  
protected function idSnapInterval_changeHandler( event:Event ) : void

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

RatingBarExample01.mxml

@PROJECT_BLOCK@

-->
<!---
* A sample of the RatingBar component.
* 
* @title RatingBar Example 1
* @tip Use the snapInterval to lock rating divisions.
* @tip Use media quiries to set different iconWidth and iconHeight for DPIs.
* @tip Use the numItems property to set the amount of visible ratings.
* @source
* @front
* @mobile
* @image assets/examples/toolkit1/RatingBarExample01_160.png 
* @author Michael Schmalle
* @copyright Teoti Graphix, LLC
-->
<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="RatingBarExampl01" >
    
    <fx:Script>
        <![CDATA[
            protected function button1_clickHandler(event:MouseEvent):void
            {
                idRatingBar.setProgress(70, idRatingBar.maximum);
            }
            
            protected function idSnapInterval_changeHandler(event:Event):void
            {
                idRatingBar.snapInterval = (idSnapInterval.selected) ? 2 : 0;
            }
            
        ]]>
    </fx:Script>
    
    <fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";
        @namespace tg "http://tg.teotigraphix.com/flex4";
        
        @media (application-dpi:160) {
            .ratingStyles {
                iconWidth:40;
                iconHeight:40;
            }
        }
        
        @media (application-dpi:240) {
            .ratingStyles {
                iconWidth:60;
                iconHeight:60;
            }
        }
        
        @media (application-dpi:320) {
            .ratingStyles {
                iconWidth:80;
                iconHeight:80;
            }
        }
        
    </fx:Style>
    
    <s:layout>
        <s:VerticalLayout paddingTop="25" horizontalAlign="center"/>
    </s:layout>
    
    <tg:RatingBar id="idRatingBar"
                  numItems="10"
                  snapInterval="0.1"
                  chromeColor="#FFFFFF"
                  styleName="ratingStyles"
                  rating="4"/>
    
    <s:Label text="{idRatingBar.rating} rating"/>
    
    <s:Button label="Set rating 7" 
              click="button1_clickHandler(event)"/>
    
    <s:CheckBox id="idSnapInterval" 
                label="Snap interval 2" 
                change="idSnapInterval_changeHandler(event)"/>
    
    <tg:RatingBar id="idRatingBar2" foregroundIconColor="#66EF14"
                  chromeColor="#FF0000" rating="45"
                  numItems="5"  snapInterval="0"/>
    
</s:View>
Mobile UI Toolkit1 v1.0.x Documentation - Thu Dec 15 10:21:33 EST 2011