Create a graphic that contains just one pixel with a graphic design program such as Paint or Photoshop. Click the the pencil tool in the graphic design program and then draw just one pixel. Save the file as a gif file named "pixelImage.gif."
Start your Flash program and open the file that contains your Flash banner ad. Convert your Flash banner ad to a movie clip. Type the code:
var adBannerContainer: MovieClip = new MovieClip();
This code will create a movie clip to contain your Flash banner ad. Add all the graphic elements of your Flash banner ad to this movie clip. For example, type the code:
adBannerContainer.addChild(bouncingball)
This code adds a graphic named "bouncingball" to the Flash ad banner in the movie clip.
Attach an event listener using the addEventListener method to the movie clip that contains your Flash banner ad.
Ad_Tracking_Instructions.addEventListener(MouseEvent.CLICK, loadTrackingImage_fn);
This code attaches a mouse click event listener to the Flash banner ad movie clip named "Ad_Tracking_Instructions."
Type the code statement for the function that will load the 1X1 tracking image when the flash banner (Ad_Tracking_Instructions) is clicked. Write the code such that it will retrieve the 1X1 tracking image stored in the file named "pixelImage.gif" with a "Loader" object named "loaderOne"
function loadTrackingimage_fn (event: MouseEvent): void
{
var url:String = "pixelImage.gif";
var urlRequesOne:URLRequest = new URLRequest(url);
var loaderOne:Loader = new Loader();
loaderOne.load(urlRequestOne);
addChild(loaderOne);
}
Save your Flash banner and upload it to the Web server that your hosting it on. Click the ad banner 30 times.
Log onto your Web server and examine "the latest visitor" statistics." Use the "search" feature of your Web hosting provider to locate the name of the graphic file -- the 1X1 tracking pixel -- that was downloaded and the number of times its was downloaded. The number of downloads will equal 30, the number of clicks on the Flash banner you made.