ActionScript Methods
| Inheritance | MovieClip > UIObject class > ThreeDimensionalChanger class |
Methods inherited from the UIObject class
The following table lists the methods the ThreeDimensionalChanger class inherits from the UIObject class.
| Method |
Description |
| UIObject.getStyle() |
Gets the style property from the style declaration or object. |
| UIObject.move() |
Moves the object to the requested position. |
| UIObject.setSize() |
Resizes the object to the requested size. |
| UIObject.setStyle() |
Sets the style property on the style declaration or object. |
Methods unique to the ThreeDimensionalChanger class
The following table lists methods of the ThreeDimensionalChanger class.
myChanger.addImage(imageLinkage, imageType[, startIndex])
imageLinkage A string that indicates either (a) the linkage identifier for an asset in the library (bitmap or symbol); or (b) the absolute or relative URL of the JPEG, GIF, PNG, or SWF file to be loaded. A relative path must be relative to the SWF file at level 0. Absolute URLs must include the protocol reference, such as http://.
imageType A string that specifies the type and location of the image you want to add to your collection. This parameter can be one of three values (the default value is "bitmap"):
bitmapbitmap from library;
symbolsymbol from library;
fileexternal file.
index An integer that specifies the index of the image in the "Images Collection" where the insertion begins. You can specify a negative integer to specify a position relative to the end of the collection (for example, -1 is the last image of the "Images Collection"). This parameter is optional.
A Boolean value of "true" if the collection was changed as a result of the operation.
Method; adds a new image to the end of the "Images Collection" or inserts it after the specified index in the array. The "Images Collection" must contain at least one image for this method to take effect at runtime.
The following example adds a new external image (flower08.jpg) to the end of the "Images Collection":
myChanger.addImage("flower08.jpg", "file");
myChanger.applyVisualEffect(name, direction, quality, speed)
name A string that specifies the type of a visual effect. The following values are acceptable for this parameter:
blursoftens the details of an image;
grayscaleconverts the RGB image to grayscale image and vice versa;
brightnesschanges the image brightness.
direction A string that specifies the direction of a visual effect. This parameter can be one of two values:
in increasing the strength of the effect;
out decreasing the strength of the effect.
quality A string that defines the depth or intensity of a visual effect. This parameter can be one of three values:
speed A string that defines the speed of increasing and decreasing of a visual effect. This parameter can be one of five values:
minimum
low
medium
high
maximum
Nothing.
Method; applies a specified visual effect to images in a 3D Image Changer component instance. The Visual Effect parameter must be set to "none" for this method to take effect.
The following example applies a grayscale effect to the changer depending on mouse interaction:
myChanger.onRollOver = function() {
myChanger.applyVisualEffect("grayscale", "in", "medium", "low");
}
myChanger.onRollOut = function() {
myChanger.applyVisualEffect("grayscale", "out", "medium", "low");
}
myChanger.clear()
Nothing.
Method; removes all of the images from the "Images Collection".
The following example calls clear():
on (click) {
myChanger.clear();
}
myChanger.getImageAt(index)
index A number that indicates the location of image within the collection. This is a zero-based index, so 0 retrieves the first image, 1 retrieves the second image, and so on.
An image object.
Method; returns an image within the "Images Collection" by using its index.
The following example compares the image at index 5 with the current image, and if they are equal — toggles the display mode:
if (myChanger.getImageAt(5) == myChanger.currentImage) {
myChanger.toggleDisplayMode();
}
myChanger.getImageIndex(image)
image An object that represents an image within the "Images Collection".
The index of a specified image within the "Images Collection".
Method; finds an image within the "Images Collection" and returns its index.
The following example checks whether the index of the current image is less than 10 and, if so, sets the value of group_name to "animals":
if (myChanger.getImageIndex(myChanger.currentImage) < 10) {
group_name = "animals";
}
myChanger.gotoFirstImage()
Nothing.
Method; navigates to the first image in the "Images Collection".
In the following example the changer navigates to the first image in the collection:
myChanger.gotoFirstImage();
myChanger.gotoImageAt(index)
index A number that indicates the location of image within the collection. This is a zero-based index, so 0 retrieves the first image, 1 retrieves the second image, and so on.
Nothing.
Method; navigates to the image in the "Images Collection" with the specified index.
In the following example the changer navigates to the image with a random index between 0 and 100:
var num:Number = Math.round(Math.random()*100);
myChanger.gotoImageAt(num);
myChanger.gotoLastImage()
Nothing.
Method; navigates to the last image in the "Images Collection".
In the following example the changer navigates to the last image in the collection:
myChanger.gotoLastImage();
myChanger.gotoNextImage()
Nothing.
Method; navigates to the next image in the "Images Collection".
In the following example the changer navigates to the next image in the collection:
myChanger.gotoNextImage();
myChanger.gotoPreviousImage()
Nothing.
Method; navigates to the previous image in the "Images Collection".
In the following example the changer navigates to the previous image in the collection:
myChanger.gotoPreviousImage();
myChanger.removeImageAt(index)
index A number that indicates the location of image within the collection. This is a zero-based index, so 0 retrieves the first image, 1 retrieves the second image, and so on. You can specify a negative integer to specify a position relative to the end of the collection (for example, -1 is the last image of the "Images Collection").
A Boolean value of "true" if an image was removed successfully; returns "false" if the image is not found.
Method; removes a single image from the "Images Collection" by using its index.
The following example removes the image at index 5 from the collection:
myChanger.removeImageAt(5);
myChanger.reset()
Nothing.
Method; resets a 3D Image Changer instance to its initial state (to the time of the first image loading) and clears it from the visual effect created by applyVisualEffect() method. It’s desirable to use the reset() method, for example, if you apply a visual effect to a changer multiple times at runtime, to avoid unexpected behavior.
The following example calls reset():
on (click) {
myChanger.reset();
}
myChanger.reverse()
Nothing.
Method; reverses the direction of rotation immediately while rotating images. This method has no effect on static image (when no rotation occurs). There are two possible cases of a changer behavior when reverse() is invoked, depending on a component’s settings:
- If
Display Mode parameter is not "manual", and delay is set to 0 — the direction of rotation reverses and the value of displayMode property changes to the opposite direction (for example, from "auto-forward" to "auto-backward").
- In other cases — the direction of rotation reverses but for the current turn only; the value of
displayMode property remains the same.
The following example calls reverse():
on (click) {
myChanger.reverse();
}
myChanger.toggleDisplayMode()
Nothing.
Method; toggles the displayMode property from "manual" to "auto-forward" / "auto-backward" and vice versa.
The following example calls toggleDisplayMode():
on (click) {
myChanger.toggleDisplayMode();
}
myChanger.togglePlayMode()
Nothing.
Method; toggles the play mode of a 3D Image Changer instance from "play" to "stop" and vice versa. Calling this method causes the images in changer to stop or resume the rotation from a stopped position instantly.
The following example calls togglePlayMode()::
on (click) {
myChanger.togglePlayMode();
}
|