📄 photoalbum_class.as
字号:
/*
PhotoAlbum class
This is an extremely simple class used to illustrate
the process and key OOP principles used in designing
a custom object.
Discussed in Chapter 2 of
Robert Penner's Programming Macromedia Flash MX
http://www.robertpenner.com/profmx
*/
_global.PhotoAlbum = function (holder_mc, photos_arr) {
this.holder = holder_mc;
this.photos = photos_arr;
this.showPhotoAt (0);
};
PhotoAlbum.prototype.showPhotoAt = function (n) {
var lastIndex = this.photos.length - 1;
if (n > lastIndex) n = 0;
else if (n < 0) n = lastIndex;
this.index = n;
this.holder.loadMovie (this.photos[this.index]);
};
PhotoAlbum.prototype.next = function () {
this.showPhotoAt (this.index + 1);
};
PhotoAlbum.prototype.prev = function () {
this.showPhotoAt (this.index - 1);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -