Hey, It’s my first time posting on this form so please excuse any policy oversight.
I’m having some major problems. With the mx.transitions class.
I have a Function that tweens the alpha of a movie clip to 0, then when that is complete, tweens the alpha back to 100. The problem is when i click the button more than once, before the tween is complete, it runs the tweening function several times in tandem.
Below is the code and the source/swf can be viewed here: http://www.unidentifiedmedia.com/fla/
Thanks for your help!
Brandon
stop();
var oldImgWidth = "";
var oldImgHeight = "";
var newImgWidth = "";
var newImgHeight = "";
var oldImgX = "";
var newImgX = "";
// TWEEN THE ALPHA LEVEL OF THE ULOADING MOVIE CLIP
var proto_object = new Object();
proto_object.fntween = function(oldImgWidth, oldImgHeight, newImgWidth, newImgHeight, oldImgX, newImgX, img_arg) {
img_mc_alphaDown = new mx.transitions.Tween(container_mc, "_alpha", mx.transitions.easing.Strong.easeIn, 100, 0, 0.5, true);
img_mc_alphaDown.onMotionFinished = function() {
//trace(img_mc_alphaDown)
easeType = mx.transitions.easing.Strong.easeOut;
var time = .7;
imgContTweenWidth = new mx.transitions.Tween(container_mc, "_width", easeType, oldImgWidth, newImgWidth, time, true);
imgContTweenHeight = new mx.transitions.Tween(container_mc, "_height", easeType, oldImgHeight, newImgHeight, time, true);
imgContTweenX = new mx.transitions.Tween(container_mc, "_x", easeType, oldImgX, newImgX, time, true);
imgContTweenHeight.onMotionFinished = function() {
trace("tweenImgContainer Finished");
img_mc_alphaUp = new mx.transitions.Tween(container_mc, "_alpha", mx.transitions.easing.Strong.easeIn, 0, 100, 0.5, true);
img_mc_alphaUp.onMotionFinished = function() {
trace("tweenImgAlphaUp Finished");
};
};
};
};
btn_mc.onRelease = function() {
delete tween_object;
//tween_object.img_mc_alphaDown
var tween_object = proto_object.fntween;
newImgWidth = (int(this._parent._parent.xmlArray[currentIMG_array].imgWidth)+5);
newImgHeight = (int(this._parent._parent.xmlArray[currentIMG_array].imgHeight)+5);
oldImgX = container_mc._x;
newImgX = ((bar_mc._width-newImgWidth)/2);
oldImgWidth = container_mc._width;
oldImgHeight = container_mc._height;
tween_object(oldImgWidth, oldImgHeight, newImgWidth, newImgHeight, oldImgX, newImgX, img_arg);
};