Sep
13

Flex Rating Component

13 comments Posted by: Laura

Flex Rating ComponentFor our new Fill Colors site, Nahuel developed a rating component to allow people to rate the Flex skins in the gallery. In this blog, we'd like to share this straightforward and easy-to-use component.

To use the rating component, you simply use a single tag <controls:Rating/> and you can specify optional attributes. We have examples of different attributes being used along with the source.

In one of the more interesting examples, Example 5, we want the rating the user selects to be displayed both in the rating component and as a number.  So we add the following attributes and text that will display the selected value:

<controls:Rating id="ratingExample5" showSelectedValue="true" />
<mx:Text text="Currently selected value: {ratingExample5.selectedValue}" />

For more information, we also have the API documentation.

View example (View source enabled on Right Click)
Download the source
View API documentation

Category: Flex | Flex Components |

13 Comments so far

Write yours
Martin Cooper
1. Martin Cooper wrote on September 13, 2007 at 4:56 PM
Nice widget. Thanks! How hard would it be to turn this into an item renderer / item editor, so that it could be used in a datagrid?
Josh Tynjala
I'm currently working on a RatingsPicker component myself. You beat me to it! ;)
Laura
Martin,

We probably should make an example of that or modify the Rating class so that implements the item renderer interfaces, but this is a simple way:
1. Create a simple mxml class, say that extends Canvas. You could implement mx.core.IDataRenderer or simply have a data variable.
2. Place the <Rating> tag inside and bind to the data.yourRatingValue property (the name of your property depends on what you are using as the dataprovider for your grid).
Albert Pack
5. Albert Pack wrote on September 20, 2007 at 4:22 PM
Its gotta be the coolest looking rating system Ive ever seen. Thanks Nahuel!
Cesare
Your widget rocks! Also documentation. Code well written!
Have you plans for a new renderer?
Laura
Cesare,
We do plan to implement the IDataRenderer so that it can be placed inside a datagrid or list.
insurancerelease.com
8. insurancerelease.com wrote on November 25, 2007 at 11:48 PM
Great to see it work. Think its a great tool as it allows the user to further contribute his or her thoughts towards a skin or in the case of other blogs their approval ratings.
shawn gibson
This is exactly what I've been looking for to replace a similar thing I had for Flash, from someone else. My site is Flex now. It relied on Shared Objects and PHP to store individual ratings. Is there any way this could be used to rate individual images...many, many of them individually...with either PHP, CF 7.0.2 or Shared Objects? I'm using xml files and my thought would be to have a rating ID within the xml (i.e., something like '<item name="Landscape Photo" piclink="images/ls/1.jpg" ratingid="001" />' to fit with my current set up) but that would be beyond me, if someone could help out with such a thing. I'd be willing to pay if needed. Shawn
HepYek
10. HepYek wrote on March 30, 2008 at 6:09 AM
Looks great!! Thanks!!
Fernando
11. Fernando wrote on April 11, 2008 at 8:16 AM
GREAT component! Thank's!!!
limitedwave
Anyone know why this component, version #5, the {ratingExample5.selectedValue} comes up 'undefined' when used within a repeater? Also - any tutorials/instructions for triggering a function when ratings are clicked? I can't seem to access the listener...thanks.
Laura
Hi,
When the rating is clicked and changes its value, you get a selectionChange event, so that you could do:
<controls:Rating selectionChange="trace('user has changed the selection!')" />

Leave your comment

Comment etiquette: As a gesture to those subscribed to this post, please keep your comments relevant to the post.

Your email address will never be displayed.
Email is gravatar enabled.Gravatar are the pictures you see next to the comments. If you like to have one, visit gravatar



Allowed tags:

<code>
All other tags will be shown as such, when in doubt, use the preview.




Preview:

Refresh Preview
1. You wrote on