📄 mc_tween2.as
字号:
} else if (objProp._prop == "__special_mc_gb__") {
new Color(objProp._targ).setTransform({gb:newValue});
} else if (objProp._prop == "__special_mc_ba__") {
new Color(objProp._targ).setTransform({ba:newValue});
} else if (objProp._prop == "__special_mc_bb__") {
new Color(objProp._targ).setTransform({bb:newValue});
} else if (objProp._prop == "__special_mc_aa__") {
new Color(objProp._targ).setTransform({aa:newValue});
} else if (objProp._prop == "__special_mc_ab__") {
new Color(objProp._targ).setTransform({ab:newValue});
}
// special hard-coded case for bezierSlideTos
if (objProp._prop == "__special_bst_t__") {
var extras = objProp._extras;
var po = _global.findPointOnCurve (extras.__special_bst_ix__, extras.__special_bst_iy__, extras.__special_bst_cx__, extras.__special_bst_cy__, extras.__special_bst_dx__, extras.__special_bst_dy__, newValue);
if (objProp._extras.mustRound) {
// 2.26.27: rounded positions
objProp._targ._x = Math.round(po.x);
objProp._targ._y = Math.round(po.y);
} else {
// Normal positions
objProp._targ._x = po.x;
objProp._targ._y = po.y;
}
}
// special hard-coded case for textfield color...
if (typeof(objProp._targ) != "movieclip" && (objProp._prop == "__special_text_b__")) {
// Special case: textfield, B value for textColor value. B being the last one to update, so also set the textfield's textColor
objProp._targ.textColor = (objProp._targ.__special_text_r__ << 16) + (objProp._targ.__special_text_g__ << 8) + objProp._targ.__special_text_b__;
}
// special hard-coded case for sound volume...
if (objProp._prop == "__special_sound_volume__") objProp._targ.setVolume(newValue);
if (objProp._prop == "__special_sound_pan__") objProp._targ.setPan(newValue);
// special hard-coded case for filters
if (objProp._prop == "__special_blur_x__") _global.$setFilterProperty (objProp._targ, "blur_blurX", newValue, objProp._extras);
if (objProp._prop == "__special_blur_y__") _global.$setFilterProperty (objProp._targ, "blur_blurY", newValue, objProp._extras);
if (objProp._prop == "__special_glow_color__") _global.$setFilterProperty (objProp._targ, "glow_color", _global.findTweenColor(objProp, tTime), objProp._extras);
if (objProp._prop == "__special_glow_alpha__") _global.$setFilterProperty (objProp._targ, "glow_alpha", newValue, objProp._extras);
if (objProp._prop == "__special_glow_blurX__") _global.$setFilterProperty (objProp._targ, "glow_blurX", newValue, objProp._extras);
if (objProp._prop == "__special_glow_blurY__") _global.$setFilterProperty (objProp._targ, "glow_blurY", newValue, objProp._extras);
if (objProp._prop == "__special_glow_strength__") _global.$setFilterProperty (objProp._targ, "glow_strength", newValue, objProp._extras);
if (objProp._prop == "__special_bevel_distance__") _global.$setFilterProperty (objProp._targ, "bevel_distance", newValue, objProp._extras);
if (objProp._prop == "__special_bevel_angle__") _global.$setFilterProperty (objProp._targ, "bevel_angle", newValue, objProp._extras);
if (objProp._prop == "__special_bevel_highlightColor__") _global.$setFilterProperty (objProp._targ, "bevel_highlightColor", _global.findTweenColor(objProp, tTime), objProp._extras);
if (objProp._prop == "__special_bevel_highlightAlpha__") _global.$setFilterProperty (objProp._targ, "bevel_highlightAlpha", newValue, objProp._extras);
if (objProp._prop == "__special_bevel_shadowColor__") _global.$setFilterProperty (objProp._targ, "bevel_shadowColor", _global.findTweenColor(objProp, tTime), objProp._extras);
if (objProp._prop == "__special_bevel_shadowAlpha__") _global.$setFilterProperty (objProp._targ, "bevel_shadowAlpha", newValue, objProp._extras);
if (objProp._prop == "__special_bevel_blurX__") _global.$setFilterProperty (objProp._targ, "bevel_blurX", newValue, objProp._extras);
if (objProp._prop == "__special_bevel_blurY__") _global.$setFilterProperty (objProp._targ, "bevel_blurY", newValue, objProp._extras);
if (objProp._prop == "__special_bevel_strength__") _global.$setFilterProperty (objProp._targ, "bevel_strength", newValue, objProp._extras);
// 2.23.26: calls the update event, if any
if (objProp._targ.onTweenUpdate != undefined) {
objProp._targ.onTweenUpdate(objProp._prop);
}
if (endTime <= tTime) {
// Past the destiny time: ended.
// 2.23.26: calls the completion event, if any
if (objProp._targ.onTweenComplete != undefined) {
objProp._targ.onTweenComplete(objProp._prop);
}
_global.$stopTween (objProp._targ, [objProp._prop], false);
// Removes from the tweening properties list array. So simpler than the previous versions :)
// (objProp still exists so it works further on)
// this.$_tweenPropList.splice(i,1); // 2.18.17 -- not needed anymore, controlled on _global.stopTween()
i--;
if (objProp._callback != undefined) {
// Calls the _callback function
if (_global.backwardCallbackTweening) {
// Old style, for compatibility.
// IF YOU'RE USING AN OLD VERSION AND WANT BACKWARD COMPATIBILITY, use this line:
// _global.backwardCallbackTweening = true;
// ON YOUR MOVIES AFTER (or before) THE #INCLUDE STATEMENT.
var childMC = objProp._targ.createEmptyMovieClip("__child__", 122344);
objProp._callback.apply(childMC, null);
childMC.removeMovieClip();
} else {
// New method for 2.12.9: use the mc scope
// So simpler. I should have done this from the start...
// ...instead of trying the impossible (using the scope from which the tween was called)
objProp._callback.apply(objProp._targ, null);
}
}
}
}
}
}
// Deletes the tween controller movieclip if no tweens are left
if (this.$_tweenPropList.length == 0) _global.$removeTweenController();
};
ASSetPropFlags(_global, "$updateTween", 1, 0);
_global.$stopTween = function(mtarget, props, wipeFuture) {
// INTERNAL USE: Removes tweening immediately, deleting it
// wipeFuture = removes future, non-executed tweenings too
var tweenPropList = _root.__tweenController__.$_tweenPropList;
var _prop;
// Deletes it
for (var pti in tweenPropList) {
_prop = tweenPropList[pti]._prop;
for (var i=0; i<props.length || (i<1 && props == undefined); i++) {
if (tweenPropList[pti]._targ == mtarget && (_prop == props[i] || props == undefined) && (wipeFuture || tweenPropList[pti]._timeDest+(tweenPropList[pti]._delay*1000) <= getTimer())) {
// Removes auxiliary vars
switch (_prop) {
case "__special_mc_frame__":
case "__special_mc_ra__":
case "__special_mc_rb__":
case "__special_mc_ga__":
case "__special_mc_gb__":
case "__special_mc_ba__":
case "__special_mc_bb__":
case "__special_mc_aa__":
case "__special_mc_ab__":
case "__special_sound_volume__":
case "__special_bst_t__":
delete mtarget[_prop];
break;
case "__special_text_b__":
delete mtarget.__special_text_r__;
delete mtarget.__special_text_g__;
delete mtarget.__special_text_b__;
break;
}
// Removes from the list
tweenPropList.splice(pti, 1);
}
}
}
// Updates the tween count "cache"
if (props == undefined) {
delete (mtarget.$_tweenCount);
} else {
mtarget.$_tweenCount = 0;
for (var pti in tweenPropList) {
if (tweenPropList[pti]._targ == mtarget) mtarget.$_tweenCount++;
}
if (mtarget.$_tweenCount == 0) delete mtarget.$_tweenCount;
}
// Check if the tween movieclip controller should still exist
if (tweenPropList.length == 0) {
// No tweenings remain, remove it
_global.$removeTweenController();
}
};
ASSetPropFlags(_global, "$stopTween", 1, 0);
_global.$setFilterProperty = function(mtarget, propName, propValue, extras) {
// Sets a property for a Flash 8-based filter.
// This is needed because you can't modify the .filter property directly; you have to re-apply it,
// and to do so in a non-destructible way (without erasing the previous filters) the array must
// be cloned...
var i;
var applied = false;
// Creates a copy of .filters
var newFilters = [];
for (var i=0; i<mtarget.filters.length; i++) {
newFilters.push(mtarget.filters[i]);
}
// Finally replaces it. This looks a bit weird, I know...
// I'll have to rewrite this later. I'm think which would be the best approach; this is too hardcoded.
if (propName.substr(0, 5) == "blur_") {
// Blur...
for (i=0; i<mtarget.filters.length; i++) {
if (newFilters[i] instanceof flash.filters.BlurFilter) {
newFilters[i][propName.substr(5)] = propValue;
if (extras.__special_blur_quality__ != undefined) newFilters[i].quality = extras.__special_blur_quality__; // Applies quality
applied = true;
break;
}
}
if (!applied) {
// Creates a new filter and applies it
var myFilter;
var quality = extras.__special_blur_quality__ == undefined ? 2 : extras.__special_blur_quality__; // Quality
if (propName == "blur_blurX") myFilter = new flash.filters.BlurFilter(propValue, 0, quality);
if (propName == "blur_blurY") myFilter = new flash.filters.BlurFilter(0, propValue, quality);
newFilters.push(myFilter);
}
} else if (propName.substr(0, 5) == "glow_") {
// Glow...
for (i=0; i<mtarget.filters.length; i++) {
if (newFilters[i] instanceof flash.filters.GlowFilter) {
newFilters[i][propName.substr(5)] = propValue;
if (extras.__special_glow_quality__ != undefined) newFilters[i].quality = extras.__special_glow_quality__; // Applies quality
if (extras.__special_glow_inner__!= undefined) newFilters[i].inner = extras.__special_glow_inner__; // Applies inner
if (extras.__special_glow_knockout__ != undefined) newFilters[i].knockout = extras.__special_glow_knockout__; // Applies knockout
applied = true;
break;
}
}
if (!applied) {
// Creates a new filter and applies it
var myFilter;
var quality = extras.__special_glow_quality__ == undefined ? 2 : extras.__special_glow_quality__; // Quality
var inner = extras.__special_glow_inner__ == undefined ? false : extras.__special_glow_inner__; // Inner
var knockout = extras.__special_glow_knockout__ == undefined ? false : extras.__special_glow_knockout__; // Knockout
if (propName == "glow_color") myFilter = new flash.filters.GlowFilter(propValue, 1, 0, 0, 1, quality, inner, knockout);
if (propName == "glow_alpha") myFilter = new flash.filters.GlowFilter(0xffffff, propValue, 0, 0, 1, quality, inner, knockout);
if (propName == "glow_blurX") myFilter = new flash.filters.GlowFilter(0xffffff, 1, propValue, 0, 1, quality, inner, knockout);
if (propName == "glow_blurY") myFilter = new flash.filters.GlowFilter(0xffffff, 1, 0, propValue, 1, quality, inner, knockout);
if (propName == "glow_strength") myFilter = new flash.filters.GlowFilter(0xffffff, 1, 0, 0, propValue, quality, inner, knockout);
newFilters.push(myFilter);
}
} else if (propName.substr(0, 6) == "bevel_") {
// Bevel...
for (i=0; i<mtarget.filters.length; i++) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -