Be the first to write a review
Building a bar chart in Flash part 2
In the second part of this tutorial, we’ll complete the bar chart class that we started in part 1. This bar chart uses the drawing API to create a chart from a set of values and labels. In part 1, we worked with default values and labels but in this part, we’ll modify the code so that you can add your own values, labels, title and bar colour.
At the end of the last tutorial, we’d created the axes for the chart and calculated the scaling for the y axis. We’d also added the chart title. In this tutorial, we’ll add the bars to the chart. First we’ll graph the default values but we’ll then modify the code so that the class accepts user input. You need to have completed the first part of the tutorial before starting this one.
This tutorial assumes that you have at least Flash MX 2004 and that you’re familiar with writing ActionScript. You won’t be able to complete the tutorial with an earlier version of Flash. If you’ve had some exposure to classes that would help, but it isn’t absolutely necessary.
You can download the files for the tutorial from the blue Properties box that contains the article PDF. There's a heading titled Code Download and you can click the Details link next to it to get the zip file that includes the starter and completed files.
Note: If you have difficulties downloading the source files or PDF, you might have a problem with your cookies. Delete the cookies from your machine and try again. In Internet Explorer, you can do this by choosing Tools > Internet Options… and clicking the Delete Cookies… button on the General tab.
Sas Jacobs
Hello. I'm the Principal of Anything Is Possible, an Australian web development business specialising in web applications development and training. I'm interested in using Flash with dynamic content and I've presented at a number of International conferences on topics relating to applications development, XML and scripting components. I have recently released my second print book Beginning XML with DOM and Ajax to match the first one - Foundation XML for Flash. I have a business web site
and a personal web site.