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

📄 mc_tween2.as

📁 openblog是一个博客管理系统
💻 AS
📖 第 1 页 / 共 5 页
字号:
	// 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.
	_global.$addTween(this, ["_xscale", "_yscale"], [propDest_scale, propDest_scale], timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "scaleTo", 1, 0);
ASSetPropFlags(TextField.prototype, "scaleTo", 1, 0);

MovieClip.prototype.xScaleTo = TextField.prototype.xScaleTo = function (propDest_scale, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Scales an object on the horizontal axis.
	_global.$addTween(this, "_xscale", propDest_scale, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "xScaleTo", 1, 0);
ASSetPropFlags(TextField.prototype, "xScaleTo", 1, 0);

MovieClip.prototype.yScaleTo = TextField.prototype.yScaleTo = function (propDest_scale, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Scales an object on the vertical axis.
	_global.$addTween(this, "_yscale", propDest_scale, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "yScaleTo", 1, 0);
ASSetPropFlags(TextField.prototype, "yScaleTo", 1, 0);

TextField.prototype.scrollTo = function (propDest_scroll, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Tweens the scroll property of a textfield.. so you can do an easing scroll to a line
	_global.$addTween(this, "scroll", propDest_scroll, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(TextField.prototype, "scrollTo", 1, 0);

MovieClip.prototype.slideTo = TextField.prototype.slideTo = function (propDest_x, propDest_y, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a xy sliding tween. Example: <movieclip>.slideTo(100, 100)
	_global.$addTween(this, ["_x", "_y"], [propDest_x, propDest_y], timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "slideTo", 1, 0);
ASSetPropFlags(TextField.prototype, "slideTo", 1, 0);

MovieClip.prototype.roundedSlideTo = TextField.prototype.roundedSlideTo = function (propDest_x, propDest_y, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a xy sliding tween on rounded pixels. Example: <movieclip>.roundedSlideTo(100, 100)
	_global.$addTween(this, ["_x", "_y"], [propDest_x, propDest_y], timeSeconds, animType, delay, callback, extra1, extra2, {mustRound:true});
};
ASSetPropFlags(MovieClip.prototype, "roundedSlideTo", 1, 0);
ASSetPropFlags(TextField.prototype, "roundedSlideTo", 1, 0);

MovieClip.prototype.xSlideTo = TextField.prototype.xSlideTo = function (propDest_x, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a xy sliding tween. Example: <movieclip>.slideTo(100, 100)
	_global.$addTween(this, "_x", propDest_x, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "xSlideTo", 1, 0);
ASSetPropFlags(TextField.prototype, "xSlideTo", 1, 0);

MovieClip.prototype.roundedXSlideTo = TextField.prototype.roundedXSlideTo = function (propDest_x, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a xy sliding tween. Example: <movieclip>.slideTo(100, 100)
	_global.$addTween(this, "_x", propDest_x, timeSeconds, animType, delay, callback, extra1, extra2, {mustRound:true});
};
ASSetPropFlags(MovieClip.prototype, "roundedXSlideTo", 1, 0);
ASSetPropFlags(TextField.prototype, "roundedXSlideTo", 1, 0);

MovieClip.prototype.ySlideTo = TextField.prototype.ySlideTo = function (propDest_y, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a xy sliding tween. Example: <movieclip>.slideTo(100, 100)
	_global.$addTween(this, "_y", propDest_y, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(MovieClip.prototype, "ySlideTo", 1, 0);
ASSetPropFlags(TextField.prototype, "ySlideTo", 1, 0);

MovieClip.prototype.roundedYSlideTo = TextField.prototype.roundedYSlideTo = function (propDest_y, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a xy sliding tween. Example: <movieclip>.slideTo(100, 100)
	_global.$addTween(this, "_y", propDest_y, timeSeconds, animType, delay, callback, extra1, extra2, {mustRound:true});
};
ASSetPropFlags(MovieClip.prototype, "roundedYSlideTo", 1, 0);
ASSetPropFlags(TextField.prototype, "roundedYSlideTo", 1, 0);

MovieClip.prototype.bezierSlideTo = TextField.prototype.bezierSlideTo = function (cpoint_x, cpoint_y, propDest_x, propDest_y, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a xy sliding tween using a bezier curve, similar to the drawing api curveTo() parameters. Example: <movieclip>.slideTo(100, 100, 200, 200)
	var extras = new Object(); // New for 2.25.27: fix for several different beziers, uses an 'extras' object. Good for all general uses.
	extras.__special_bst_ix__ = undefined; // Initial X position. Has to be remembered
	extras.__special_bst_iy__ = undefined; // Initial Y position. Has to be remembered
	extras.__special_bst_cx__ = cpoint_x; // Control point X position. Has to be remembered
	extras.__special_bst_cy__ = cpoint_y; // Control point Y position. Has to be remembered
	extras.__special_bst_dx__ = propDest_x; // Final X position. Has to be remembered
	extras.__special_bst_dy__ = propDest_y; // Final Y position. Has to be remembered
	_global.$addTween(this, "__special_bst_t__", 1, timeSeconds, animType, delay, callback, extra1, extra2, extras);
};
ASSetPropFlags(MovieClip.prototype, "bezierSlideTo", 1, 0);
ASSetPropFlags(TextField.prototype, "bezierSlideTo", 1, 0);

MovieClip.prototype.roundedBezierSlideTo = TextField.prototype.roundedBezierSlideTo = function (cpoint_x, cpoint_y, propDest_x, propDest_y, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a xy sliding tween using a bezier curve, similar to the drawing api curveTo() parameters. Example: <movieclip>.slideTo(100, 100, 200, 200)
	var extras = new Object(); // New for 2.25.27: fix for several different beziers, uses an 'extras' object. Good for all general uses.
	extras.__special_bst_ix__ = undefined; // Initial X position. Has to be remembered
	extras.__special_bst_iy__ = undefined; // Initial Y position. Has to be remembered
	extras.__special_bst_cx__ = cpoint_x; // Control point X position. Has to be remembered
	extras.__special_bst_cy__ = cpoint_y; // Control point Y position. Has to be remembered
	extras.__special_bst_dx__ = propDest_x; // Final X position. Has to be remembered
	extras.__special_bst_dy__ = propDest_y; // Final Y position. Has to be remembered
	extras.mustRound = true;
	_global.$addTween(this, "__special_bst_t__", 1, timeSeconds, animType, delay, callback, extra1, extra2, extras);
};
ASSetPropFlags(MovieClip.prototype, "roundedBezierSlideTo", 1, 0);
ASSetPropFlags(TextField.prototype, "roundedBezierSlideTo", 1, 0);

Sound.prototype.volumeTo = function (propDest_volume, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a sound volume tween, 'fading' from one volume set to another (0->100)
	_global.$addTween(this, "__special_sound_volume__", propDest_volume, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(Sound.prototype, "volumeTo", 1, 0);

Sound.prototype.panTo = function (propDest_volume, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a panning tween, 'fading' from one pan set to another (-100->100)
	_global.$addTween(this, "__special_sound_pan__", propDest_volume, timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(Sound.prototype, "panTo", 1, 0);

MovieClip.prototype.colorTo = function (propDest_color, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a simple color transformation (tint) tweening.
	// Works like Flash MX's color.setRGB method.
	//  Example: <movieclip>.colorTo(0xFF6CD9)
	// If the first parameter is null or omitted, it just resets its tinting.
	if (propDest_color == null) {
		// Just reset the colorTransformation
		this.colorTransformTo(100, 0, 100, 0, 100, 0, undefined, undefined, timeSeconds, animType, delay, callback, extra1, extra2);
	} else {
		// Just do a colorTransformTo tween, since it's a movieclip
		var new_r = propDest_color >> 16;
		var new_g = (propDest_color & 0x00FF00) >> 8;
		var new_b = propDest_color & 0x0000FF;
		this.colorTransformTo (0, new_r, 0, new_g, 0, new_b, undefined, undefined, timeSeconds, animType, delay, callback, extra1, extra2);
	}
};
ASSetPropFlags(MovieClip.prototype, "colorTo", 1, 0);

TextField.prototype.colorTo = function (propDest_color, timeSeconds, animType, delay, callback, extra1, extra2) {
	// Does a simple color transformation (tint) tweening.
	// Works like Flash MX's color.setRGB method.
	//  Example: <textfield>.colorTo(0xFF6CD9)
	// On the textfield's case, it sets its color directly.
	var new_r = propDest_color >> 16;
	var new_g = (propDest_color & 0x00FF00) >> 8;
	var new_b = propDest_color & 0x0000FF;
	// __special_text_?__ is understood by the tweening function as being a map to its textcolor's RGB value
	_global.$addTween(this, ["__special_text_r__", "__special_text_g__", "__special_text_b__"], [new_r, new_g, new_b], timeSeconds, animType, delay, callback, extra1, extra2);
};
ASSetPropFlags(TextField.prototype, "colorTo", 1, 0);

MovieClip.prototype.colorTransformTo = function () {
	// Does a color transformation tweening, based on Flash's "advanced" color transformation settings.
	// Works like Flash MX's color.setTransform method, although it uses properties directly as parameters and not a color object
	//  Example: <movieclip>.colorTransformTo(200, 0, 200, 0, 200, 0, undefined, undefined, 2) --> 'dodged' colors
	//           <movieclip>.colorTransformTo(100, 0, 100, 0, 100, 0, 100, 0, 2)  --> 'normal' state of a movieclip
	// ra = red alpha, % of the original object's color to remain on the new object
	// rb = red offset, how much to add to the red color
	// ga, gb = same for green
	// ba, bb = same for blue
	// aa, ab = same for alpha
	if (typeof(arguments[0]) == "object" && arguments[0] != undefined) {
		// 2.19.22 :: It's a color transform object.
		_global.$addTween(this, ["__special_mc_ra__", "__special_mc_rb__", "__special_mc_ga__", "__special_mc_gb__", "__special_mc_ba__", "__special_mc_bb__", "__special_mc_aa__", "__special_mc_ab__"], [arguments[0].ra, arguments[0].rb, arguments[0].ga, arguments[0].gb, arguments[0].ba, arguments[0].bb, arguments[0].aa, arguments[0].ab], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]);
	} else {
		// Normal parameters passed.
		_global.$addTween(this, ["__special_mc_ra__", "__special_mc_rb__", "__special_mc_ga__", "__special_mc_gb__", "__special_mc_ba__", "__special_mc_bb__", "__special_mc_aa__", "__special_mc_ab__"], [arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7]], arguments[8], arguments[9], arguments[10], arguments[11], arguments[12], arguments[13]);
	}
};
ASSetPropFlags(MovieClip.prototype, "colorTransformTo", 1, 0);

/*
===============================================================================
Flash 8 filters methods/functions
-------------------------------------------------------------------------------
These methods create .filters tweenings. Should only be used on Flash 8 files,
exported as either AS1 or AS2. They're a bit weird because the .filters
property is not modifiable - you have to create a copy of it and reapply
everything - but it seems to work fine.
-------------------------------------------------------------------------------
*/

// Blur -------------------------

MovieClip.prototype.blurTo = TextField.prototype.blurTo = function () {
	// Creates a blur on the object.
	// 1 -> (propDest_blur, quality, timeSeconds, animType, delay, callback, extra1, extra2)
	// 2 -> (BlurFilter, timeSeconds, animType, delay, callback, extra1, extra2)

⌨️ 快捷键说明

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