PDA

View Full Version : controling movieClip with one function


Navarone
10-07-2009, 05:37 PM
I am working on building an accordion style menu using Tweener. I have 3 movieClips on my stage, I can add a tween to each but I need a little help getting the menu items to end in the correct position. In my code below this line tells the movieClip to move to a position of y=25.

Tweener.addTween(mc,{y:25, time:1});

I changed mc to box1 and box2 which makes evey thing move when I click, but how do I set up my function so I can click box1 and it will slide up and then click box2 and it slides up.


import caurina.transitions.Tweener;

setupRollOver(box0);
setupRollOver(box1);
setupRollOver(box2);

box0.boxText.text = "Step 1";
box1.boxText.text = "Step 2";
box2.boxText.text = "Step 3";

function setupRollOver(mc:MovieClip):void {
// add a local variable to each clip
mc.buttonMode = true;
mc.addEventListener(MouseEvent.CLICK, onOver, false, 0, true);
}

function onOver(evt:MouseEvent):void {
var mc:MovieClip = MovieClip(evt.target);
//Tweener.addTween(mc,{y:25, time:1});
Tweener.addTween(box1,{y:25, time:1});
Tweener.addTween(box2,{y:50, time:1});
}

ExNihilio
10-08-2009, 08:42 AM
give this function to click events of your mcs.


function onClick(event:MouseEvent):void{
Tweener.addTween(event.currentTarget,{y:25, time:1});
}