I have been searching for an answer to my actionscript 3 problem... I'm new to the community and actionscript so please bear with me. I am using a array to store my data and have six movie clips I have wrapped in separate functions. Each function will use a tween animation property for each movie clip. I have two buttons (nextBtn & prevBtn) and I want to call each function using the nextBtn and the array. Thank-you for your reply. Here is my code:
stop();
var animArr:Array = [anim1, anim2, anim3, anim4, anim5];
var blindsObj:Object = {type:Blinds,
direction:Transition.IN,
duration:2,
easing:Strong.easeOut,
numStrips:10,
dimension:1};
// REGISTER your buttonListeners */
nextBtn.label = "Play";
// **** ANIMATION FUNCTIONS */
function anim1()
{
var myTween:Tween = new Tween(panel_2,
"x",
Elastic.easeIn,
650, -22, 2, true);
}
function anim2()
{
TransitionManager.start(panel_3,
{type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});
}
function anim3()
{
TransitionManager.start(panel_4,
{type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:9});
}
function anim4()
{
nextBtn.enabled = false;
panel_5.alpha = 1.0;// 100% (reset alpha)
var transition:Transition = TransitionManager.start(panel_5,blindsObj);
transition.addEventListener("transitionInDone", transition_transitionInDone);
}
function anim5()
{
var myTweener:Tween = new Tween(panel_6.txtBox,
"x",
Elastic.easeIn,
-1850, 225, 2, true);
}
////////////////////////////////////////////// END ANIMATION FUNCTIONS */
// **** transition the blindsObj tween */
function transition_transitionInDone(e:Event):void
{
nextBtn.enabled = true;
panel_5.alpha = 0.5;// 50%
}
for ( var i=0; i < animArr.length; i++ )
{
nextBtn.addEventListener( MouseEvent.CLICK, nextHandler );
//prevBtn.addEventListener( MouseEvent.CLICK, prevHandler );
}
// **** FUNCTION TO MOVE THE MOVIECLIP FORWARD */
function nextHandler(e:MouseEvent):void
{
trace( "you clicked " + e.target.name );
panel_2.MovieClip = animArr[1];
}