Flex 2.0.1 Rating Component
April 28, 2007
Allot of online applications today presenting anything from news, to photos, to video all have a public rating feature. So here is a component that can serve as a really good start.
Originally shown as a sample in the Primitive Explorer I thought I’d break it out of that and into a post of it’s own. Mostly because as one could understand, not everyone is interested in primitives, and I’d hate to see someone reinvent code that is available.
So working off some of the work done in the Primitive Explorer I built this sample rating component. There are similar classes in this component as in the primitive explorer and I’ve made no effort to trim them down to only the necessary code. They are part of a larger package and I thought it best to keep them in tact as to not cause confusion for later updates to either. So everything in com.Primitives is part of that earlier work.
The Flex 2.0.1 Rating component can be used either stand alone or as an itemRenderer. Support for all styles listed in the PrimitiveStyles.as. Tooltips are set as an array using the tooltips property. You could create a 1-10 star rating by changing the private itemCount variable (I haven’t tried that). 5 stars is the default. If your using it in a datagrid as an itemRenderer the editorDataField should be set to “value”.
Sample and Source : Rating Component
Enjoy.
Jason Hawryluk
May 11, 2007 at 6:10 pm
Oh no, the source is a dead link!!! was really hoping to try the example.
May 11, 2007 at 6:30 pm
TimG,
Sorry for that but the server seems to be down.
It happens every now and then (beyond my control).
Try back a little later.
jason
July 16, 2007 at 3:25 pm
[…] for the Springgraph component, Doug McCune for the SuperTabNavigator, and Jason Hawryluk for the Flex Rating Component used in this […]
February 4, 2008 at 1:03 am
Hey jason, sorry but I can’t seem to find the link for the source code? I only see the sample. I must be dense.
Anyway, it’s a really good component and I’ll like to adapt it for a school project I’m working on. Great work!
February 4, 2008 at 1:11 am
Ohh. Nevermind, I got it. Right click! Now I’m ashamed.
February 17, 2008 at 2:28 pm
I’m trying to use the rating component as a filter for selecting videos in a product selector. Nevertheless, I constantly get the warning “Data binding will not be able to detect assignments to value”. The initial value is used and any other value which is dynamically changed by the user is not taken into account. Anyone knows what this causes and what the solution will be?
May 27, 2008 at 7:50 pm
Jason, this is a really nice component and very useful. You also hit perfectly on the color choices 😉
I made two very small additions with just a few lines of code — I added support for the enabled property so that the user cannot change the rating if the control is disabled, and I made it so the tooltips could be changed after creation. In my case, I wanted the tooltips to initially read something like “Login to rate this item”
Great work and thanks for sharing.
June 5, 2008 at 9:38 pm
@Garth
How did you add support for the enabled property?
Any help is appreciated.
October 25, 2008 at 7:40 am
Very beautiful and informative blog, is more than such!
October 28, 2008 at 3:29 am
Where is the source/link for this? Was REALLY hoping to be able to use this.
Thanks in advance,
Tami
April 8, 2010 at 2:34 am
Hey jason, sorry but I can’t seem to find the link for the source code? I only see the sample. I must be dense.
April 9, 2010 at 9:11 am
Run the sample, right click view source.
Here is a direct line to the source..
http://www.flexibleexperiments.com/Flex/RatingComponent/srcview/index.html
cheers
Jason
August 3, 2010 at 6:08 pm
Hi,
I was inspired by your component, I replaced the drawing of stars by images, manage select value and result value, change some events and other few things.
I put the result and the source here :
http://exae57.free.fr/codememo/?p=398
I hope that the use of your sources is not a problem.
I still have some improvements to be made.
August 3, 2010 at 6:12 pm
[…] du composant de Jason Hawryluk j’ai réalisé un composant Flex pour voter, très simple à utiliser il permet […]
April 13, 2011 at 8:09 pm
Good work! thank you )
January 30, 2015 at 4:57 pm
[…] 今回は下記で紹介されているスターレーティング用コンポーネントをDataGridで使ってみた。 https://flexibleexperiments.wordpress.com/2007/04/28/flex-201-rating-component/ […]