Be the first to write a review
Building Components with ActionScript 2.0 – part 2
Welcome to the second article in this series on building custom components. In part 1, I showed you the steps required to create a custom component. In this tutorial, we’ll create our first simple component from scratch. The component will generate a simple shape – circle, oval, square, rectangle or triangle – and allow us to set the colour. You’ll also be able to size the component from the Properties panel. We’ll call this the Shape component.
In this tutorial, we’ll cover:
- Planning the component
- Creating the movie clip for the component
- Creating the class file for the component
- Associating the class file with the movie clip
- Generating the component
- Using the component in another Flash file
I’ve assumed 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.
Before you can complete the tutorial, you’ll need to have a good understanding of creating class files in ActionScript 2.0. I’ve used Flash 8 for the sample files so you’ll need this version if you want to explore to completed example. You can also recreate the example in Flash MX 2004.
You can download the files referred to in this 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.
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.