Be the first to write a review
Creating a line chart component – part 2
In part 1 of this tutorial, we started to create the line chart component. We created a movie clip containing the assets that we need as well as the class file. We added some private variables and created a constructor function as well as an init function to set up the component.
In part 2, we’ll finish off the line chart by adding the public parameters. We’ll do this using setter methods and the createChildren function. You’ll see how to use the drawing API to create the axes and the line.
This tutorial uses Flash 8 and ActionScript 2 with the version 2 component architecture, so you’ll need Flash 8 to view my completed files. You can still create the component using Flash MX 2004.
The tutorial assumes that you understand the general process of creating a component. If not, you might want to go back and look at the first article in this series. I have also assumed that you know how to write AS2.0 class files.
You don’t have to have completed part 1 of the tutorial first before starting on this article, but it will help. If you haven’t done so, the resource files included with the tutorial contain the files as we left them after the first tutorial. In that case, you’ll need to unzip the resources and rename the files LineChart.as and LineChart.fla.
You can download the starter files from part 1 as well as the completed component files 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.
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.