| Article Index |
|---|
| ImageRotater v1.3 |
| Documentation |
| Download |
| Demo |
| All Pages |
Documentation
System Requirements
This component was developed and tested under Flash® 8 Professional on Windows® XP Professional. It SHOULD work under Flash 8 Standard, but I have not tested this configuration. It is unknown if this component will work on versions of Flash below version 8. No installation support will be provided for unsupported versions of Flash.
Purpose
This Flash Component was designed to make it easier to rotate externally loaded JPG, GIF, and PNG files into a Flash movie. The component loads the images and scales them proportionantly (and optionally centers the scaled image) to fit within the component dimensions. Sample uses for this component are banner ads, photo galleries, and art portfolios.
Usage
This component was designed to be as simple to use as possible. To use the component, drag an instance from the Components panel in the Flash authoring enviroment onto the stage and give the component a name such as "ir_mc". Next, open the Actions panel and either create a two-dimensional array with the following elements:
var imageData:Array = new Array();
imageData[0] = new Array();
imageData[0][0] = "path/to/your/image; String";
imageData[0][1] = "image width; Number";
imageData[0][2] = "image height; Number";
imageData[0][3] = "optional array element with a URL to link to; String"
imageData[0][4] = "optional target (if not set, the target is the current window); String
ir_mc.items = imageData;
Optionally you can pass an array into Flash from a server-side scripting language such as PHP .
Using the example array above, if the imageData array contained more than one element, it would rotate the images automatically based on the rotation interval (number of seconds between images) entered in the Property Inspector for the component. If there were only one element in the imageData array, the component would not rotate even if a rotation interval is set.
Component Parameters
These are the component parameters that are set in the Property Inspector for the component at design time.
- Center image - Center the loaded image(s) within the component dimensions
or not. - Image array - An array containing the image information.
- Random rotation - If more than one image is in the array, is the rotation random or linear (ordered as the images appear in the image array).
- Rotation interval - The number of seconds between images when rotating.
Public Properties
These properties can be used from ActionScript to modify the component at runtime.
- centerImage:Boolean - Center the loaded image(s) within the component dimensions
or not. - items:Array - An array containing the information for the image(s) to be loaded.
- randomRotation:Boolean - Whether the rotation of the images is random or linear.
- rotationInterval:Number - The number of seconds between the image rotations.
- selectedIndex:Number - The currently loaded image position in the items array.
Public Methods
These methods can be used from ActionScript to modify the component at runtime.
- clearContents():Void - clears the currently loaded image from the display and sets the items array to NULL. This was added to disable the component during the playback of the Flash movie.
- nextImage():Void - displays the next image in the array. If the currently selected image is the last image in the array, it displays the first image inthe array. This was added to allow for manual changing of images with ActionScript attached to a button or movie clip.
- previousImage():Void - displays the previous image in the array. If the currently selected image is the first image in the array, it displays the last image in the array. This was added to allow for manual changing of images with ActionScript attached to a button or movie clip.
- reload(Array):Void - reloads the image rotation with the array passed as an argument. This was added to allow multiple image arrays to be loaded during playback of the Flash movie.
Using/Modifying the Source Code
By installing the Image Rotater component using the Macromedia Extension manager, the ActionScript source code, the source FLA file, and the Image Rotater icon were also installed to your system. Those files are located in the directory where you were prompted to save files to during the installation.
To modify the component, copy the files in the source directory to another location on your computer. (This will ensure that you always have a clean copy of the source files.) Once you have copied all of the files, you will need to modify your ActionScript 2.0 Classpath to point to the root folder of the copied files; either at the document level or the application level, before testing/compiling the modified component. Consult the Flash documentation on how to complete this task. For example, say you copy the source files to
C:Flash workImageRoater
You would need to add that directory to your classpath. If you change the component name or move the ActionScript class file out of /net/ronaldferguson/components directory, you will also need to modify the class name in the .as file as well as change the fully qualified class name in the source FLA file to reflect the class file location.


