Center Next Nested Movieclip to Center of Stage


i have 4 image movieclips nested inside of "strip" movieclip , want move horizontally next image using mouse event. not centering , don't understand why if statements aren't working.

 

import fl.transitions.tween;
import fl.transitions.easing.*;

 

var targetx:number = (stage.stagewidth / 2 - strip.img02.x - strip.img02.width) / 2;
var mytween:tween = new tween(strip, "x", elastic.easeout, strip.x, targetx, 3, true);

 

rightbtn.addeventlistener(mouseevent.click, right);
function right(e:mouseevent):void{
    if (var targetx:number = (stage.stagewidth / 2 - strip.img01.x - strip.img01.width) / 2;)
    {
        var targetx:number = (stage.stagewidth / 2 - strip.img02.x - strip.img02.width) / 2;
        var mytween:tween = new tween(strip, "x", elastic.easeout, strip.x, targetx, 3, true);
    }
    else if (var targetx:number = (stage.stagewidth / 2 - strip.img02.x - strip.img02.width) / 2;)
    {
        var targetx:number = (stage.stagewidth / 2 - strip.img03.x - strip.img03.width) / 2;
        var mytween:tween = new tween(strip, "x", elastic.easeout, strip.x, targetx, 3, true);
    }

 

}

please don't open duplicate threads.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts