Skip navigation
subtlefly72
Currently Being Moderated

Making an interactive bar graph?

Apr 4, 2012 6:49 PM

Hi tEam,

Ok maybe trying to be too clever here.. Where should I look to find out how to do this.. I want to make an interactive gizmo to explore 20%. so I want a little slider and a red (20%) and a green (80%) bar so that when I slide the slider to different numbers - lets say between 1 and 100 I get a graphical representation of 20% of the number selected as well as the actual numbers?  make sense? so at 50   red column is 10 green is 40. at 100 red is 20 and green is 80?

 

I could just have a MC with different frames and select a few numbers to highlight and fake it. (which I might end up doing)  but I would like to know how to do this dynamically if you guys can point me in the right direction.

Cheers

sub

 
Replies
  • Currently Being Moderated
    Apr 5, 2012 4:37 AM   in reply to subtlefly72

    Understanding mathematics, especially basics like percentages, is an integral part of programming.  If 50 is supposed to be 50%, then you change it to a percentage value (0.5) and assign that as the scaleY property of the bars.  If you want to display relative numeric values, then you calculate them and use textfields tot display them.  Whenevr the values change you reassign the new values to the textfields.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 4:52 AM   in reply to subtlefly72

    One very simple method is to just draw a rectangle with 80% green and 20% red. Make it a movieclip. Then you can just change the scaleX or scaleY property of that movieclip to make its length or height match the selected number. The ratio of red to green doesn't ever change, just the selected number.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points