[AS2.0]相册类简陋版
/**
 * 标题: 相册类 
 * 版权: Copyright (c) 2005
 * 作者: 棉花糖
 * 版本: 1.1
 * 时间: 2005.08.12
*/
class Album.Album
{
	//========================================
	//属性声明
	private var mPoint:Number = 1;
	private var mNumMax:Number;
	private var mTarget:MovieClip;
	private var mNameArray:Array;
	private var mRelativePath:String = "";
	//========================================
	//构造函数
	public function Album($target:MovieClip, $nameArray:Array, $relativePath:String)
	{
		mTarget = $target;
		mNameArray = $nameArray;
		if (arguments.length > 2) {
			mRelativePath = arguments[2] + "/";
		}
		mNumMax = $nameArray.length;
		//mTarget.createEmptyMovieClip("tmp1", 1);
		//mTarget.createEmptyMovieClip("tmp0", 0);
	}
	//========================================
	//加载方法
	public function PhotoShow($num:Number)
	{
		if (arguments.length > 0) {
			mPoint = AssignToPointCheckUp($num);
		}
		mTarget.loadMovie(mRelativePath + mNameArray[mPoint - 1]);
	}
	//========================================
	//上翻方法
	public function Up():Void
	{
		mPoint = AddDelToPointCheckUp(mPoint - 1);
		PhotoShow();
	}
	//========================================
	//下翻方法
	public function Down():Void
	{
		mPoint = AddDelToPointCheckUp(mPoint + 1);
		PhotoShow();
	}
	//========================================
	//Point属性隐式获取方法
	public function get Point():Number
	{
		return mPoint;
	}
	//========================================
	//Point属性隐式设置方法
	public function set Point($num:Number):Void
	{
		mPoint = AssignToPointCheckUp($num);
	}
	//========================================
	//Point属性增删检测
	private function AddDelToPointCheckUp($num:Number):Number
	{
		if ($num < 1) {
			return mNumMax;
		} else if ($num > mNumMax) {
			return 1;
		} else {
			return $num;
		}
	}
	//========================================
	//Point属性赋值检测
	private function AssignToPointCheckUp($num:Number):Number
	{
		if ($num < 1) {
			return 1;
		} else if ($num > mNumMax) {
			return mNumMax;
		} else {
			return $num;
		}
	}
}



使用如下:
//引入类文件
import Album.Album;
//指定“相框”
this.createEmptyMovieClip("myMc", 1);
//指定相片列表(数组)
var myArray:Array = new Array("1.jpg", "2.jpg", "3.jpg");
/*声明Album类。注:第三个参数为可选参数,指定相片所在的子集文件路径;无此参数时相片应与swf文件位于同一目录下,*/
var myAlbum:Album = new Album(myMc, myArray, "abc");
myAlbum.PhotoShow();
up.onPress = function()
{
    myAlbum.Up();
};
down.onPress = function()
{
    myAlbum.Down();
};
[2005-8-27 17:53]

{CommentAuthor} [{CommentTime}]  
{CommentContent}