This is my first time posting a question so please excuse me if I don’t explain everything correctly. A little background on the project: I am creating a flash site. I’ve done this before but since I don’t have a lot of experience with actionscript, I use timeline tweens which increases the flash file size drastically. This time around I’d like to create an efficient lightweight flash site using actionscript tweens.
On to the question… I have my page title mc’s on the stage with instance names like title1, title2, title3, etc… I’d like to create a reusable function that I can call when clicking a button. I want the function to fade out any title mc that already has an alpha of 100 and when that tween is complete, fade in the new title mc. How can I target the mc that has an alpha of 100 without creating a function for each? Here’s what I have (it doesn’t work & excuse the mess, I’m very much a newbie with as):
function fadeTitle(target) {
target._alpha = 0;
var oldTitle = “title”+n; //this is what I need help with. I want n to be any number 0-6
if (oldTitle._alpha=100) {
var fadeOutTween:Tween = new Tween(oldTitle, “_alpha”, mx.transitions.easing.None.easeNone, 100, 0, 20, false);
var xPosOutTween:Tween = new Tween(oldTitle, “_x”, Regular.easeOut, 16, 26, 20, false);
trace(“fading old title out”);
}
xPosOutTween.onMotionFinished = function() {
var fadeInTween:Tween = new Tween(target, “_alpha”, mx.transitions.easing.None.easeNone, 0, 100, 20, false);
var xPosInTween:Tween = new Tween(target, “_x”, Regular.easeOut, 6, 16, 20, false);
trace(“fading new title in”);
};
}
navAbout.onRelease = function() {
fadeTitle(title2);
}
Thanks! I probably have this all wrong :tired: