Be the first to write a review
Working with Bitmaps in Flash 8 - part 1
Flash 8 includes a new class: flash.display.BitmapData that lets you work with bitmap information. When you work with bitmaps in Flash, the Flash Player doesn’t have to redraw the image each frame so there’s less overhead.
You can create bitmaps using ActionScript, add colours, apply filters and apply many types of manipulations. You can also use a BitmapData object to fill a movie clip. You may have seen this in an earlier example.
This is the first of two articles about the BitmapData class. In this article I’ll look at:
- creating a BitmapData object
- attaching a BitmapData object to a movie clip
- creating noise in a BitmapData object
- modifying a BitmapData object
In the examples, I’ll show you how to create realistic looking TV static and you’ll also learn how to create repeating patterns in a BitmapData object. Our final example will show you how to fill a movie clip with colour like you would with the in Paint Bucket tool.
Part 2 of this article will show you some more tricks with the BitmapData class including:
- Working with individual pixels
- Using the draw method to turn a movie clip into a bitmap
- Applying filters to BitmapData objects
You’ll need a copy of Flash 8 to work through this article as well as the Flash 8 Player. You can download a trial copy from the Macromedia Web site. Note that the code samples within the article all use AS2.0.
You can download the files referred to in 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.
This article is part of the new interactive e-book; Out of my mind: Flash 8 Power
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.