A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Making Things Follow Your Mouse Then Stop

  1. #1
    JJ79
    Join Date
    Oct 2003
    Location
    London
    Posts
    133

    Making Things Follow Your Mouse Then Stop

    HI,

    Ive been stuck on this idea for 2 weeks on and off.... this is the last piece of the website I have.... the links bit at top of page....
    http://sail.joolo.com/test/

    this is a swf of what I have done so far.... (its not final graphics of course but explains it (flash file attached!!))

    each shade of blue is going to be a button.... when you roll over the white box will move to you mouse then open up more details of link.... when you move onto next colour the box will close and stay at the last point you rolled off it.... its a great effect if done!

    the problem is ALL boxes want to move with mouse???... can someone help me? The script I think looks ok but has been cobbled together!


    thanks
    Last edited by jonnyP; 05-03-2010 at 03:02 PM.
    ;-)

  2. #2
    JJ79
    Join Date
    Oct 2003
    Location
    London
    Posts
    133
    I am really up against it now as had promised to show a working website by tomorrow!!...

    If someone wants to give me a price to fix this problem?
    Im really stuck on it...

    thanks
    Jp
    ;-)

  3. #3
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Check the fla attached, I think this is what you mean.
    Feel free to use!
    Stage size = 750 x 300
    6 buttons(btn_1,btn_2...etc)
    6 hovers (mc1,mc2...etc)
    Code on main timeline.
    code:
    fscommand("allowscale", false);
    for (i=1; i<7; i++) {
    _root["btn_"+i].onRollOver = function() {
    //trace(this._name);
    id = this._name;
    switch (id) {
    case "btn_1" :
    followMouse(btn_1, mc1, 0, 125);
    break;
    case "btn_2" :
    followMouse(btn_2, mc2, 125, 250);
    break;
    case "btn_3" :
    followMouse(btn_3, mc3, 250, 375);
    break;
    case "btn_4" :
    followMouse(btn_4, mc4, 375, 500);
    break;
    case "btn_5" :
    followMouse(btn_5, mc5, 500, 625);
    break;
    case "btn_6" :
    followMouse(btn_6, mc6, 625, 750);
    break;
    //default = else do this
    default :
    //
    }
    };
    }
    function followMouse(btn, mc, xMin, xMax) {
    var ypos = mc._y;
    mc.gotoAndPlay(2);
    onEnterFrame = function () {
    if (_root._ymouse>0 && _root._ymouse<400 && _root._xmouse>xMin && _root._xmouse<xMax) {
    ypos = _root._ymouse;
    }
    mc._y += (ypos-mc._y)/7;
    if (mc._y<45) {
    mc._y = 45;
    }
    if (mc._y>250) {
    mc._y = 250;
    }
    btn.onRollOut = function() {
    mc.gotoAndPlay(5);
    if (_parent._xmouse<xMin || parent._xmouse>xMax) {
    mc.gotoAndPlay(5);
    }
    delete onEnterFrame;
    };
    };
    }

    Attached Files Attached Files

  4. #4
    JJ79
    Join Date
    Oct 2003
    Location
    London
    Posts
    133
    Thanks so so much!!!!!!

    thats exactly what I was looking for!! have spent a week trying to get this to
    work!!!

    Hopefully I can get the website up before the end of weekend!

    cheers again!
    jp
    ;-)

  5. #5
    JJ79
    Join Date
    Oct 2003
    Location
    London
    Posts
    133
    Hi Hum,

    Sorry can I ask one more question then it should be done.....

    Instead of the box shrinking down when you say roll off the botom of movie.... is there any way to keep it open until you rollover one of the rollovers again?

    thanks
    Jp
    ;-)

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