A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23

Thread: Slide to the next Button menu

  1. #21
    You again?!?!?! gunko2's Avatar
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    171
    ok here u go, a guy named scotty from kirupa forum helped me put together this code....
    just replace the code in the first frame that i gave u, to this one:
    code:

    var mSpeed = 7;
    var mxT;
    _root.mcArrow._x = mxT;
    MovieClip.prototype.mMove = function(mxTarget) {
    this.onEnterFrame = function() {
    this._x += (mxTarget-this._x)/mSpeed;
    if (Math.abs(mxTarget-this._x)<1) {
    this._x = mxTarget;
    delete this.onEnterFrame;
    }
    };
    };
    for (nNum=1; nNum<=50; nNum++) {
    MC = _root["mc"+nNum];
    MC.onRollOver = function() {
    mcArrow.mMove(this._x);
    };
    MC.onRollOut = function() {
    mcArrow.mMove(mxT);
    };
    MC.onPress = function() {
    mxT = this._x;
    };
    }


    hope this helps....
    again - if u have any questions - i'm here!

  2. #22
    Senior Member
    Join Date
    Mar 2001
    Posts
    131
    OH MY GOD!!!

    Gunko, it is official, you have been granted super hero stardom in my books!

    Thank you so much for this, it is exactly what I have been trying to do - you are amazing.

    I have ammended the code to work on the y axis instead of x.
    so now it looks like this:

    var mSpeed = 4;
    var mxT;
    _root.mcArrow._y = mxT;
    MovieClip.prototype.mMove = function(mxTarget) {
    this.onEnterFrame = function() {
    this._y += (mxTarget-this._y)/mSpeed;
    if (Math.abs(mxTarget-this._y)<1) {
    this._y = mxTarget;
    delete this.onEnterFrame;
    }
    };
    };
    for (nNum=1; nNum<=50; nNum++) {
    MC = _root["mc"+nNum];
    MC.onRollOver = function() {
    mcArrow.mMove(this._y);
    };
    MC.onRollOut = function() {
    mcArrow.mMove(mxT);
    };
    MC.onPress = function() {
    mxT = this._y;
    };
    }

    I only have one problem. The starting postion (before any clicks) is now above the first button off the top of the page do I have to put in at the beginning declare a ypos on the McArrow something like: ypos = 20

    I know this is asking alot but if you have time could you give me a quick explanantion of how this is working I understand a bit but would love to know what is going on. (perhaps some comments in the code?)

    attached is my updated fla for you to see
    Attached Files Attached Files

  3. #23
    You again?!?!?! gunko2's Avatar
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    171
    sorry man but i get an unexpected format error....
    and i don't really understand the problem....
    u meant that the arrow (before pressing any button) always returns to the top?
    if so then just change the value of mxT to what position u like it to slide to.... for example:
    code:

    var mxT = 200;


    this will make the arrow slide to a y position of 200....
    hope this helps....

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