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.

RatingComponent

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

16 Responses to “Flex 2.0.1 Rating Component”

  1. TimG Says:

    Oh no, the source is a dead link!!! was really hoping to try the example.


  2. 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


  3. […] for the Springgraph component, Doug McCune for the SuperTabNavigator, and Jason Hawryluk for the Flex Rating Component used in this […]

  4. Alicia Says:

    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!

  5. Alicia Says:

    Ohh. Nevermind, I got it. Right click! Now I’m ashamed.

  6. Bram Says:

    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?

  7. Garth Somerville Says:

    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.

  8. Adam Says:

    @Garth

    How did you add support for the enabled property?

    Any help is appreciated.

  9. flexgirl Says:

    Where is the source/link for this? Was REALLY hoping to be able to use this.

    Thanks in advance,

    Tami

  10. Vitaly Says:

    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.

  11. Eric Says:

    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.


  12. […] du composant de Jason Hawryluk j’ai réalisé un composant Flex pour voter, très simple à utiliser il permet […]


  13. Good work! thank you )


  14. […] 今回は下記で紹介されているスターレーティング用コンポーネントをDataGridで使ってみた。 https://flexibleexperiments.wordpress.com/2007/04/28/flex-201-rating-component/ […]


Leave a comment