| Package | ardisia.components.rating |
| Class | public class Rating |
| Inheritance | Rating spark.components.SkinnableDataContainer |
| Implements | mx.managers.IFocusManagerComponent |
View the technical documentation on the Ardisia Labs website for more information.
Default MXML PropertydataProvider
| Property | Defined By | ||
|---|---|---|---|
| alignment : String
Set the alignment of the renderers. | Rating | ||
| dataTipFormatFunction : Function
User provided callback function that formats the string displayed in the
data tip. | Rating | ||
| dataTipHideDelay : Number = 350
Delay before the data tip is hidden. | Rating | ||
| dataTipInstance : DataTip
Instance of the data tip. | Rating | ||
| dataTipPrecision : int = 2
Number of decimal places to use for the data tip text. | Rating | ||
| editable : Boolean = true
Whether users can select values via hover. | Rating | ||
| gap : Number
The gap between renderers in the layout. | Rating | ||
| layoutAxis : String
The axis along which the renderers are laid out. | Rating | ||
| maxValue : Number
The maximum allowed value and also sets the number of renderers that
are created. | Rating | ||
| showDataTip : Boolean = true
Set to true to display the highlight value in a dataTip. | Rating | ||
| snapInterval : Number
Defines how precise the selected value is. | Rating | ||
| value : Number
Holds the rating value selected by the user or set programatically. | Rating | ||
| verticalLayoutDirection : String
The direction the renderers are laid out if the layoutAxis is set to
"vertical". | Rating | ||
| Property | Defined By | ||
|---|---|---|---|
| collection : ArrayCollection
Collection used to populate the internal dataProvider. | Rating | ||
| lastHighlightValue : Number = NaN
Stores the value of the last highlighted or hovered value that was not
necessarily committed to the "value" property. | Rating | ||
| numberFormatter : NumberFormatter
Reference to the numberFormatter used if a dataTip format function is
not defined. | Rating | ||
| tileLayout : TileLayout
Layout class that is hard-wired. | Rating | ||
| Method | Defined By | ||
|---|---|---|---|
hideDataTip():void
Hide the data tip. | Rating | ||
| Method | Defined By | ||
|---|---|---|---|
displayDataTip(renderer:IRatingRenderer):void
Display the data tip. | Rating | ||
eventHandler(event:Event):void
Handles renderer mouse events. | Rating | ||
getDataTipContent(data:Object):Object
Returns the contents for the data tip. | Rating | ||
mouseHandler(event:MouseEvent):void
Handles mouse events over the control. | Rating | ||
rendererAddHandler(event:RendererExistenceEvent):void
Add mouse listeners to renderers as they are added. | Rating | ||
rendererRemoveHandler(event:RendererExistenceEvent):void
Remove mouse listeners from renderers as they are removed. | Rating | ||
setHighlightOnRenderer(renderer:IRatingRenderer):void
Sets the "percentHighlightFill" property on the passed renderer. | Rating | ||
setupDataTip(data:Object):void
Setup the data tip. | Rating | ||
setValue(value:Number, dispatch:Boolean = true):void
Update the "value" property without invalidating properties and
optionally updating any binding(s). | Rating | ||
updateDataGroup():void
Update the dataGroup skin part. | Rating | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when the committed value changes due to user interaction. | Rating | |||
| Dispatched when the committed value changes. | Rating | |||
This component uses skins made up of skin parts. Do not set the skin parts directly. The component's skin sets the skin parts.
| Skin Part | Description | Defined By | ||
|---|---|---|---|---|
dataTipFactoryPart:mx.core.IFactory | Required: false Part Type: Dynamic The data tip. The IFactory must return an object of type DataTip | Rating | ||
| alignment | property |
alignment:StringSet the alignment of the renderers. Has the same options as the "horizontalAlignment" and "verticalAlignment" properties for the TileLayout class.
Not relevant if the Rating is sized to its measured dimensions.
The default value is "noJustify".
public function get alignment():String public function set alignment(value:String):void| collection | property |
protected var collection:ArrayCollectionCollection used to populate the internal dataProvider.
Not exposed.
| dataTipFormatFunction | property |
public var dataTipFormatFunction:FunctionUser provided callback function that formats the string displayed in the data tip. The function takes a float as an argument and returns either a TextFlow or a String for the data tip contents.
The function has the following signature:
funcName(value:Number):Object
The default value is null.
| dataTipHideDelay | property |
public var dataTipHideDelay:Number = 350Delay before the data tip is hidden.
The default value is 350.
| dataTipInstance | property |
public var dataTipInstance:DataTipInstance of the data tip.
| dataTipPrecision | property |
public var dataTipPrecision:int = 2Number of decimal places to use for the data tip text.
Ignored if the "dataTipFormatFunction" property is not null.
The default value is 2.
| editable | property |
public var editable:Boolean = trueWhether users can select values via hover.
The default value is true.
| gap | property |
gap:NumberThe gap between renderers in the layout.
Ignored if the "alignment" property is set to "justifyUsingGap" or "justifyUsingSpace".
The default value is 2.
public function get gap():Number public function set gap(value:Number):void| lastHighlightValue | property |
protected var lastHighlightValue:Number = NaNStores the value of the last highlighted or hovered value that was not necessarily committed to the "value" property.
The value that is displayed in the dataTip.
| layoutAxis | property |
layoutAxis:StringThe axis along which the renderers are laid out. Recognized values are "horizontal" or "vertical".
The default value is "horizontal".
public function get layoutAxis():String public function set layoutAxis(value:String):void| maxValue | property |
maxValue:NumberThe maximum allowed value and also sets the number of renderers that are created.
The default value is 5.
public function get maxValue():Number public function set maxValue(value:Number):void| numberFormatter | property |
protected var numberFormatter:NumberFormatterReference to the numberFormatter used if a dataTip format function is not defined.
| showDataTip | property |
public var showDataTip:Boolean = trueSet to true to display the highlight value in a dataTip.
The default value is true.
| snapInterval | property |
snapInterval:NumberDefines how precise the selected value is. Defaults to "1", meaning that the user selects 1 point, 2 points, etc. Set to a different float between 0 and 1 to define a more precise rating.
For example, 0.5, would allow users to select ratings in 0.5 point intervals.
Values that are 0 or negative will default to as small a snapInterval as possible. Values greater than 1 will be set to 1.
The default value is 1.
public function get snapInterval():Number public function set snapInterval(value:Number):void| tileLayout | property |
protected var tileLayout:TileLayoutLayout class that is hard-wired.
| value | property |
value:NumberHolds the rating value selected by the user or set programatically.
Is bindable; dispatches "valueCommit" events.
The default value is 0.
This property can be used as the source for data binding.
public function get value():Number public function set value(value:Number):void| verticalLayoutDirection | property |
verticalLayoutDirection:StringThe direction the renderers are laid out if the layoutAxis is set to "vertical".
top to bottom "ttb" or bottom to top "btt".
The default value is "ttb".
public function get verticalLayoutDirection():String public function set verticalLayoutDirection(value:String):void| displayDataTip | () | method |
protected function displayDataTip(renderer:IRatingRenderer):voidDisplay the data tip.
Parameters
renderer:IRatingRenderer |
| eventHandler | () | method |
protected function eventHandler(event:Event):voidHandles renderer mouse events. Presumes renderers implement the IRatingRenderer interface.
Ignored if disableSelection is true.
Parameters
event:Event — The Event that triggered the handler.
|
| getDataTipContent | () | method |
protected function getDataTipContent(data:Object):ObjectReturns the contents for the data tip. Uses the "dataTipField" first, then the "dataTipFormatFunction" function, then the class default.
Can return a TextFlow or a String.
Parameters
data:Object — Object
|
Object — Object
|
| hideDataTip | () | method |
public function hideDataTip():voidHide the data tip.
| mouseHandler | () | method |
protected function mouseHandler(event:MouseEvent):voidHandles mouse events over the control.
Useful to hold renderer highlighting until the mouse leaves the entire control, rather than a single renderer. This stops flickering of the renderers when mousing between them.
Parameters
event:MouseEvent — the MouseEvent that triggered the handler.
|
| rendererAddHandler | () | method |
protected function rendererAddHandler(event:RendererExistenceEvent):voidAdd mouse listeners to renderers as they are added.
Parameters
event:RendererExistenceEvent — the RendererExistenceEvent event that triggered the
handler
|
| rendererRemoveHandler | () | method |
protected function rendererRemoveHandler(event:RendererExistenceEvent):voidRemove mouse listeners from renderers as they are removed.
Parameters
event:RendererExistenceEvent — the RendererExistenceEvent event that triggered the
handler
|
| setHighlightOnRenderer | () | method |
protected function setHighlightOnRenderer(renderer:IRatingRenderer):voidSets the "percentHighlightFill" property on the passed renderer. Calculations depend on whether layout is horizontal or vertical and whether the "verticalLayoutDirection" is "btt" or "ttb".
Parameters
renderer:IRatingRenderer — a renderer that implements IRatingRenderer
|
| setupDataTip | () | method |
protected function setupDataTip(data:Object):voidSetup the data tip. Must be positioned elsewhere.
Parameters
data:Object — Object the data to setup the content of the data tip
|
| setValue | () | method |
protected function setValue(value:Number, dispatch:Boolean = true):voidUpdate the "value" property without invalidating properties and optionally updating any binding(s).
Parameters
value:Number — the Number to set the "value" property to
| |
dispatch:Boolean (default = true) — true to dispatch a FlexEvent.CHANGE event
|
| updateDataGroup | () | method |
protected function updateDataGroup():voidUpdate the dataGroup skin part.
| change | Event |
ardisia.components.rating.events.RatingEventardisia.components.rating.events.RatingEventDispatched when the committed value changes due to user interaction.
| valueCommit | Event |
mx.events.FlexEventmx.events.FlexEventDispatched when the committed value changes.