Simple AS3 Slideshow Widget: Part 3

This is the final post in a three part tutorial detailing the creation of a Flash slideshow widget using ActionScript 3.0. Have a look over Part 1 and Part 2 before moving ahead. In this post, we are examining the two methods which actually handle image loading and display within our module. 1 2 3 4 5 6 7 8 9 10 11 12 private function switchImage(e:TimerEvent):void { imageBitmapData.draw(this); imageBitmap.bitmapData = imageBitmapData; imageBitmap.alpha = 1; if(currentImage < imageArray.length-1){ currentImage++; }else{ currentImage = 0; } urlRequ.url = appPath + "path/to/images/" + imageArray[currentImage]; imageLoader.load(urlRequ); }private function switchImage(e:TimerEvent):void { imageBitmapData.draw(this); imageBitmap.bitmapData = imageBitmapData;

Continue reading »

Simple AS3 Slideshow Widget: Part 2

In Part 1, we had a look at the basic structure of what we are working toward, including a PHP file to read images from a directory and return a list of images to Flash, the setup of our FLA, and the basic construction of our document class. This widget, being so simple, will only require the document class. We will now go through each method and describe what is happening… 1 2 3 4 5 6 7 8 9 10 11 12 13 public function SlideShow():void { if (root.loaderInfo.parameters.appPath != undefined) { appPath = root.loaderInfo.parameters.appPath; } else { appPath

Continue reading »

Simple AS3 Slideshow Widget: Part 1

This is a simple example of how to build a dynamic slideshow widget in Flash using ActionScript 3.0 such as the one seen here. The first thing you’ll need to do is set up an FLA with the properties you’d like to exhibit. Stage resolution is set to 500×300 with a black background. This will vary depending on the size of your generated images. Be sure that your FLA is set to use ActionScript 3.0 and declare your document class, in this case “SlideShow”. Let’s set up a PHP file to read from the directory of our choosing and return

Continue reading »

Testing Flash Projects w/ Dynamic Variables

Many of the Flash modules and widgets I write are part of a larger system. Normally, some sort of ID or other variable piece of data will need to be passed in as flashvars upon initialization to allow the SWF to function correctly, making the appropriate data calls and so forth. When testing in the IDE, however, you are separated from the larger application and that data does not exist. A simple way to test such items in the standalone Flash Player is to check whether those variables are being passed in… if not- simply use your test variables. 1

Continue reading »