dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Changing Direction of a MovieClip with easing

  1. #1
    Junior Member
    Join Date
    May 2004
    Location
    Midland, Texas
    Posts
    21

    Changing Direction of a MovieClip with easing

    I am using Flash MX Professional 2004 exporting to Flash Player 7 / Actionscript 2.0.

    I have a MovieClip that is a long horizontal string of 20 individual images (each the same size back-to-back like a slide show). I have a mask on the layer above which only allows one imge underneath to show at a time if the MovieClip is moved right or left.

    What I need to do is script 20 individual buttons on the stage that will shift this MovieClip right or left and make it stop at the corresponding image (for the button selected) revealed by the mask above.

    I also need the MovieClip to Ease to a stop on each image.

    I have seen this done several places, but don't know how it is done? In other words it acts similar to the FlashLoaded Thumbnailer (which I own), but it can be controlled externally with a button to move to a precise location on button release.

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Posts
    2,467
    Hi choreo:

    Place this on your MC:


    Code:
    onClipEvent (load) {
    this._x=50;  // sets original x
    this.finalX=50;
    this._y=50;  // sets original y
    this.finalY=50;
    }
    onClipEvent(enterFrame){
    this._x +=((finalX - this._x)/5); // x easing formula
    this._y +=((finalY - this._y)/5); // y easing formula
    }
    Put this on your button(s):

    Code:
    on (release) {
    _root.myClip.finalX=250; //target x
    _root.myClip.finalY=50; //target y
    }
    If you are only moving on the x axis, you can remove the y portion, except for setting orginal y (this._y), or just make sure that this._y and finalY are the same.

    -james
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life."

    Image Popup Scripting Engine | Thumb PopUp Script | HTML Anchors w/Flash | Popup Script Generator | Seq. Img Swap | Img Swap | Browser Shake | Rand. Img Swap | Inline Img Swap | Screen Res. PopUp | Screen Resolution Popup Script


  3. #3
    Junior Member
    Join Date
    May 2004
    Location
    Midland, Texas
    Posts
    21
    James,

    Many thanks for the good tip. I think that nailed it!

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