⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mc_tween2.as

📁 一个用flash制作的网页电子相册。值得拿来大家分享一下。
💻 AS
📖 第 1 页 / 共 5 页
字号:
			if (newFilters[i] instanceof flash.filters.BevelFilter) {
				newFilters[i][propName.substr(6)] = propValue;
				if (extras.__special_bevel_quality__ != undefined) newFilters[i].quality = extras.__special_bevel_quality__; // Applies quality
				if (extras.__special_bevel_type__!= undefined) newFilters[i].inner = extras.__special_bevel_type__; // Applies type
				if (extras.__special_bevel_knockout__ != undefined) newFilters[i].knockout = extras.__special_bevel_knockout__; // Applies knockout
				applied = true;
				break;
			}
		}
		if (!applied) {
			// Creates a new filter and applies it
			var myFilter;
			var quality = extras.__special_bevel_quality__ == undefined ? 2 : extras.__special_bevel_quality__; // Quality
			var type = extras.__special_bevel_type__ == undefined ? "inner" : extras.__special_bevel_type__; // Inner
			var knockout = extras.__special_bevel_knockout__ == undefined ? false : extras.__special_bevel_knockout__; // Knockout
			if (propName == "bevel_distance") myFilter = new flash.filters.BevelFilter(propValue, 45, 0xffffff, 1, 0x000000, 1, 0, 0, 1, quality, type, knockout);
			if (propName == "bevel_angle") myFilter = new flash.filters.BevelFilter(0, propValue, 0xffffff, 1, 0x000000, 1, 0, 0, 1, quality, type, knockout);
			if (propName == "bevel_highlightColor") myFilter = new flash.filters.BevelFilter(0, 45, propValue, 1, 0x000000, 1, 0, 0, 1, quality, type, knockout);
			if (propName == "bevel_highlightAlpha") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, propValue, 0x000000, 1, 0, 0, 1, quality, type, knockout);
			if (propName == "bevel_shadowColor") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, propValue, 1, 0, 0, 1, quality, type, knockout);
			if (propName == "bevel_shadowAlpha") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, 0x000000, propValue, 0, 0, 1, quality, type, knockout);
			if (propName == "bevel_blurX") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, propValue, 0, 1, quality, type, knockout);
			if (propName == "bevel_blurY") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, 0, propValue, 1, quality, type, knockout);
			if (propName == "bevel_strength") myFilter = new flash.filters.BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, 0, 0, propValue, quality, type, knockout);
			newFilters.push(myFilter);
		}
	} else {
		// Can't do anything
//		trace ("MC TWEEN ### Error on $setFilterProperty: propName \""+propName+"\" is not valid.");
		return;
	}
	// And reapplies the filter
	mtarget.filters = newFilters;
};

/*
===============================================================================
Main methods/functions
-------------------------------------------------------------------------------
The most basic tweening functions - for starting, stopping, pausing, etc.
-------------------------------------------------------------------------------
*/

MovieClip.prototype.tween = TextField.prototype.tween = Sound.prototype.tween = function (prop, propDest, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Starts a variable/property/attribute tween for an specific object.
	_global.$addTween(this, prop, propDest, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "tween", 1, 0);
ASSetPropFlags(TextField.prototype, "tween", 1, 0);
ASSetPropFlags(Sound.prototype, "tween", 1, 0);

MovieClip.prototype.roundedTween = TextField.prototype.roundedTween = Sound.prototype.roundedTween = function (prop, propDest, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Starts a variable/property/attribute tween for an specific object, and uses only rounded values when updating
	_global.$addTween(this, prop, propDest, timeSeconds, animType, delay, callback, extra1, extra2, {mustRound:true});
};
ASSetPropFlags(MovieClip.prototype, "roundedTween", 1, 0);
ASSetPropFlags(TextField.prototype, "roundedTween", 1, 0);
ASSetPropFlags(Sound.prototype, "roundedTween", 1, 0);

MovieClip.prototype.stopTween = TextField.prototype.stopTween = Sound.prototype.stopTween = function(props) {
	// Removes tweenings immediately, leaving objects as-is. Examples:
	//  <movieclip>.stopTween ("_x");          // Stops _x tweening
	//  <movieclip>.stopTween (["_x", "_y"]);  // Stops _x and _y tweening
	//  <movieclip>.stopTween ("_x", "_y");  // Stops _x and _y tweening
	//  <movieclip>.stopTween ();              // Stops all tweening processes
	if (typeof (props) == "string") props = [props]; // in case of one property, turn into array
	if (props != undefined) {
		// 2.22.26: counts all arguments as parameters too
		for (var i=1; i<arguments.length; i++) props.push(arguments[i]);
	}
	_global.$stopTween(this, props, true);
};
ASSetPropFlags(MovieClip.prototype, "stopTween", 1, 0);
ASSetPropFlags(TextField.prototype, "stopTween", 1, 0);
ASSetPropFlags(Sound.prototype, "stopTween", 1, 0);

MovieClip.prototype.pauseTween = TextField.prototype.pauseTween = Sound.prototype.pauseTween = function(props) {
	// Pauses all tweenings currently being executed for this object (this includes delayed tweenings), unless specific property names are passed as a parameter.
	//  Examples:
	//  <sound>.pauseTween();
	//  <movieclip>.pauseTween("_x");
	//  <textfield>.pauseTween("_alpha", "_y");

	if (props != undefined) {
		if (typeof (props) == "string") props = [props]; // in case of one property, turn into array
		for (var i=1; i<Arguments.length; i++) props.push(Arguments[i]);
	}

	var tweenPropList = _root.__tweenController__.$_tweenPropList;
	var mustPause;

	for (var pti in tweenPropList) {
		if (tweenPropList[pti]._targ == this && !tweenPropList[pti]._isPaused) {
			if (props != undefined) {
				// Tests if it can be stopped
				mustPause = false;
				for (var i in props) {
					if (props[i] == tweenPropList[pti]._prop) {
						mustPause = true;
						break;
					}
				}
			}
			if (props == undefined || mustPause) {
				tweenPropList[pti]._isPaused = true;
				tweenPropList[pti]._timePaused = _root.__tweenController__.$_tTime;
			}
		}
	}
};
ASSetPropFlags(MovieClip.prototype, "pauseTween", 1, 0);
ASSetPropFlags(TextField.prototype, "pauseTween", 1, 0);
ASSetPropFlags(Sound.prototype, "pauseTween", 1, 0);

MovieClip.prototype.resumeTween = TextField.prototype.resumeTween = Sound.prototype.resumeTween = function(props) {
	// Resumes all tweenings currently paused for this object, unless specific property names are passed as a parameter.

	if (props != undefined) {
		if (typeof (props) == "string") props = [props]; // in case of one property, turn into array
		for (var i=1; i<Arguments.length; i++) props.push(Arguments[i]);
	}

	var tweenPropList = _root.__tweenController__.$_tweenPropList;
	var mustResume;
	var offsetTime;

	for (var pti in tweenPropList) {
		if (tweenPropList[pti]._targ == this && tweenPropList[pti]._isPaused) {
			if (props != undefined) {
				// Tests if it can be resumed
				mustResume = false;
				for (var i in props) {
					if (props[i] == tweenPropList[pti]._prop) {
						mustResume = true;
						break;
					}
				}
			}
			if (props == undefined || mustResume) {
				tweenPropList[pti]._isPaused = false;
				offsetTime = _root.__tweenController__.$_tTime - tweenPropList[pti]._timePaused;
				tweenPropList[pti]._timeStart += offsetTime;
				tweenPropList[pti]._timeDest += offsetTime;
				tweenPropList[pti]._timePaused = 0;
			}
		}
	}
};
ASSetPropFlags(MovieClip.prototype, "resumeTween", 1, 0);
ASSetPropFlags(TextField.prototype, "resumeTween", 1, 0);
ASSetPropFlags(Sound.prototype, "resumeTween", 1, 0);

MovieClip.prototype.lockTween = TextField.prototype.lockTween = Sound.prototype.lockTween = function() {
	// Locks this object for tweening
	this.$_isTweenLocked = true;
	ASSetPropFlags(this, "this.$_isTweenLocked", 1, 0);
};
ASSetPropFlags(MovieClip.prototype, "lockTween", 1, 0);
ASSetPropFlags(TextField.prototype, "lockTween", 1, 0);
ASSetPropFlags(Sound.prototype, "lockTween", 1, 0);

MovieClip.prototype.unlockTween = TextField.prototype.unlockTween = Sound.prototype.unlockTween = function() {
	// Unlocks this object for tweening
	delete (this.$_isTweenLocked);
};
ASSetPropFlags(MovieClip.prototype, "unlockTween", 1, 0);
ASSetPropFlags(TextField.prototype, "unlockTween", 1, 0);
ASSetPropFlags(Sound.prototype, "unlockTween", 1, 0);

MovieClip.prototype.getTweens = TextField.prototype.getTweens = Sound.prototype.getTweens = function() {
	// Returns the number of tweenings actually being executed
	// Tweenings are NOT overwritten, so it's possible to have a series of tweenings at the same time
	return (this.$_tweenCount);
};
ASSetPropFlags(MovieClip.prototype, "getTweens", 1, 0);
ASSetPropFlags(TextField.prototype, "getTweens", 1, 0);
ASSetPropFlags(Sound.prototype, "getTweens", 1, 0);

MovieClip.prototype.isTweening = TextField.prototype.isTweening = Sound.prototype.isTweening = function() {
	// Returns true if there's at least one tweening being executed, otherwise false
	return (this.$_tweenCount > 0 ? true : false);
};
ASSetPropFlags(MovieClip.prototype, "isTweening", 1, 0);
ASSetPropFlags(TextField.prototype, "isTweening", 1, 0);
ASSetPropFlags(Sound.prototype, "isTweening", 1, 0);


/*
===============================================================================
Shortcut methods/functions
-------------------------------------------------------------------------------
Start tweenings with different commands. These methods are used mostly for code
readability and special handling of some non-property attributes (like movieclip
color, sound volume, etc) but also to make the coding easier for non-expert
programmers or designers.
-------------------------------------------------------------------------------
*/

MovieClip.prototype.alphaTo = TextField.prototype.alphaTo = function (propDest_a, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does an alpha tween. Example: <movieclip>.alphaTo(100)
	_global.$addTween(this, "_alpha", propDest_a, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "alphaTo", 1, 0);
ASSetPropFlags(TextField.prototype, "alphaTo", 1, 0);

MovieClip.prototype.frameTo = function(propDest_frame, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a frame tween - kinf of like a gotoAndPlay(), but with time and equations. Example: <movieclip>.frameTo(20, 1, "easeinoutexpo")
	_global.$addTween(this, "__special_mc_frame__", propDest_frame, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "frameTo", 1, 0);

MovieClip.prototype.rotateTo = TextField.prototype.rotateTo = function (propDest_rotation, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Rotates an object given a degree.
	_global.$addTween(this, "_rotation", propDest_rotation, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "rotateTo", 1, 0);
ASSetPropFlags(TextField.prototype, "rotateTo", 1, 0);

MovieClip.prototype.scaleTo = TextField.prototype.scaleTo = function (propDest_scale, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Scales an object uniformly.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -