5 Replies Latest reply on May 3, 2011 5:44 PM by kglad

    AS2 Dynamic graph




      I want to create a set of buttons with assigned values, that after adding one to another, passes the value to graphsbar width.


      here is somewhat ilustrated example of the structure




      In a practical way, the groupA could be different processor types, groupB; graphic cards and groupC; motherboards.

      every button has 3 values that refers to: Velocity, Performance, Power usage (for example).

      adding the value1 from groupA.ButtonA1, the value1 from groupB.ButtonB1 and so on... would give us a total width of the bar1


      what would be the function to make this possible?


      so far I'm using the TweenLite engine to do the tweening, and the code for 1 group is like this :

      function group1(graph, value1, value2, value3)

      TweenLite.to(graph.bar1, .5, {_height:value1});  
      TweenLite.to(graph.bar2, .5, {_height:value2});  
      TweenLite.to(graph.bar3, .5, {_height:value3});  


      buttonA1.onRelease = function(){
         group1(performancegraph, 80, 90, 30);

      buttonA2.onRelease = function(){
         group1(performancegraph, 45, 20, 5);

      this only alters the initial values of the graph, how to construct all the rest?


      I was thinking on adding a variable like


      var Bar1TotalWidth:Number = group1.value1+group2.value1;


      and put the Bar1TotalWidth into the _height:value1 but I'm totally lost now.


      I'd appreciate help.