I have 6 movieclip buttons with actionscript. (btn1, btn2, etc)
I have 6 movieclips that fade in text. (01_mc, 02_mc, etc)
When a btn receives an onRelease it moves to the top. But I also want it to play it’s corresponding movieclip. (btn1 = 01_mc, btn2 = 02_mc, etc
I know how to it like this:
btn1.onRelease = function () {
mc_fix.attachMovie ("01_mc", "o", 1, {_x:450, _y:-150});
btn1.onRollOut = function () {
mc_fix.o.removeMovieClip();
However I can not put that into my current code as it does not work. I believe this may be beyond me.
Current code:
var _topXArray:Array = [90,90,90,90,90,90]
var _bottomXArray:Array = [50,125,200,270,350,425]
var _rotationArray:Array = [-90,-149,148,89,30,-30]
var _scaleArray:Array = [50,50,50,50,50,50]
// the y position when the single button moves to the top
var _topY:Number = 160;
// the y position for all the other buttons moving to the bottom
var _bottomY:Number = 310;
// loop through the buttons, giving each these paramaters
for (var i = 1; i <=6; i++) {
var thisBtn = this["btn"+i];
this["btn"+i].filters = [myBevelFilter]
thisBtn.topX = _topXArray[i-1];
thisBtn.bottomX = _bottomXArray[i-1];
thisBtn.rotationTarget = _rotationArray[i-1];
thisBtn.scaleTarget = _scaleArray[i-1];
thisBtn.onRelease = function () {
doAnim(this);
}
}
}
function doAnim (whichClip:MovieClip) :Void {
// loop through the buttons
for (var i = 1; i <=6; i++) {
var thisBtn = this["btn"+i];
// if the current button is the one moving to the top then it moves to the top
if (thisBtn == whichClip) {
var myXTween:Tween = new Tween(thisBtn, "_x", mx.transitions.easing.Regular.easeOut, thisBtn._x, thisBtn.topX, 1, true);
var myYTween:Tween = new Tween(thisBtn, "_y", mx.transitions.easing.Regular.easeOut, thisBtn._y, _topY, 1, true);
var myRotationTween:Tween = new Tween(thisBtn, "_rotation", mx.transitions.easing.Regular.easeOut, thisBtn._rotation, thisBtn.rotationTarget+180, 1, true);
var myScaleTween:Tween = new Tween(thisBtn, "_xscale", mx.transitions.easing.Regular.easeOut, thisBtn._xscale, thisBtn.scaleTarget+50, 1, true);
var myScaleTween:Tween = new Tween(thisBtn, "_yscale", mx.transitions.easing.Regular.easeOut, thisBtn._yscale, thisBtn.scaleTarget+50, 1, true);
}
// otherwise it moves to the bottom
else {
var myXTween:Tween = new Tween(thisBtn, "_x", mx.transitions.easing.Regular.easeOut, thisBtn._x, thisBtn.bottomX, 1, true);
var myYTween:Tween = new Tween(thisBtn, "_y", mx.transitions.easing.Regular.easeOut, thisBtn._y, _bottomY, 1, true);
var myRotationTween:Tween = new Tween(thisBtn, "_rotation", mx.transitions.easing.Regular.easeOut, thisBtn._rotation, thisBtn.rotationTarget, 1, true);
var myScaleTween:Tween = new Tween(thisBtn, "_xscale", mx.transitions.easing.Regular.easeOut, thisBtn._xscale, thisBtn.scaleTarget, 1, true);
var myScaleTween:Tween = new Tween(thisBtn, "_yscale", mx.transitions.easing.Regular.easeOut, thisBtn._yscale, thisBtn.scaleTarget, 1, true);
}
}
}
I’m assuming I have to stick it somehow in the doAnim but I do not know how. Please assist.