One area with enhanced functionality is the Drawing API. The Drawing API allows you to add drawings to Flash using ActionScript. The Flash 8 Drawing API includes:
- Additional options when setting a lineStyle
- Additional options when creating a gradient
- A new method to create a line with a gradient
- A new method that allows you fill with a bitmap
In this article, I’m going to look at the changes to the lineStyle method. I’ll show you how you can set the scaling, pixelHinting, capsStyle and jointStyle using ActionScript. In the next article, we’ll look at working with gradients and filling a drawing with a bitmap.
You’ll need a copy of Flash 8 to see the features covered in this article. You can download a trial copy from the Macromedia Web site. You should also install Flash Player 8 so you can publish these features. Because they include changes to ActionScript, you can’t publish to Flash Player 7 and earlier. Note that the code samples within this article all use AS2.0.
You can download the sample file 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.
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.
We’ll start with a quick overview of the Flash MX 2004 Drawing API.