dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: button trigger - moving MC from a to b with tween

  1. #1
    Junior Member
    Join Date
    Mar 2008
    Posts
    9

    button trigger - moving MC from a to b with tween

    Hello,

    Basically I have a great big movieclip that the user can move around and explore. But I also want to add buttons that will take them from their current location to a new one with a tween. So MC's current XnY pos to new XY pos...

    I've managed to get the MC to jump from one location to the next with this code:

    animation.onPress = function() {
    doodleboard.onEnterFrame = function() {
    xstart=this._x;
    ystart=this._y;
    ytarget=this._y = 1643;
    xtarget=this._x = 55.5;

    };
    };

    (animation being the button name and doodleboard being the MC name)

    does anyone knwo how to get it to tween to it's new location?
    Last edited by jiminibob; 03-22-2008 at 01:34 PM.

  2. #2
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    try something like this. (this is untested) but should point you in the right direction

    PHP Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;



    animation.onPress xMoveTo(doodleboard,this._x,this._y);


    function 
    xMoveTo(who,xStartyStart){
        var 
    myTween:Tween = new Tween(who"_x"mx.transitions.easing.Regular.easeInxStart55.53true);
        var 
    myTween:Tween = new Tween(who"_y"mx.transitions.easing.Regular.easeInyStart16433true);


  3. #3
    Junior Member
    Join Date
    Mar 2008
    Posts
    9
    Thanks for that - almost does what I need, just a few minor tweaks to look at but definately points me in the right direction. I'll play around a bit now I've got the basics and post the code if I get it working.

    Thanks again -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center