[COLOR=#000000][FONT=verdana]Hi there,
I have 9 movieclips, and 9 buttons. (mc1, mc2, mc3… & btn1, btn2, btn3…)
I’d like it so that when you rollover the button, the corresponding movieclip begins an animation.
I thought I was on the right tracks here:
for (var i:int = 0; i < 8; i++) {
this["btn"+i].addEventListener(MouseEvent.MOUSE_OVER, onButtonOver);
this["btn"+i].addEventListener(MouseEvent.MOUSE_OUT, onButtonOut);
this["btn"+i].addEventListener(MouseEvent.CLICK, onButtonClicked);
this["btn"+i].buttonMode=true;
this["btn"+i].mouseChildren=false;
this["btn"+i].id=i;
}
function onButtonOver(e:MouseEvent):void {
var movieclipVar="mc"+e.target.id;// this is what is meant to allow me to target a movieclip, rather than the original button.
Tweener.addTween(movieclipVar, {x:100, time:0.5, transition:"easeOutBack"});
}
function onButtonOut(e:MouseEvent):void {
Tweener.addTween(movieclipVar, {x:0, time:0.5, transition:"easeOutBack"});
}
function onButtonClicked(e:MouseEvent):void {
movieclipVar.gotoAndStop(25);
}
I just can’t seem to direct a tween to a corresponding movieclip dynamically. Any help would be greatly appreciated.
Cheers.[/FONT][/COLOR]