A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: how is this done?

  1. #1
    the indian sunmillennium's Avatar
    Join Date
    Nov 2000
    Location
    New Delhi INDIA
    Posts
    249
    hi
    can some body please tell me how the group of rectangles move after the mouse ( i mean the complete effect ) in the menu strip in the site - http://www.futurebrand.com ?

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    302
    hi,

    nice effect indeed.
    How it works? Well, there are some things you can derive from it. (How I think it´s done.)
    1) the blocks: mc´s with a stop action in the first frame, code that checks the position of the cursor and set it´s own position accordingly in the second frame, loop to frame 2 in the third frame, code that moves it back in the fourth and a loop to fr4 in fr5.
    2) the speed in which the blocks move is set as a function of the distance of the cursor from the current position of the blocks.
    3) the code contains a variable that reduces the speed (dividing the distance calculated by 2)) This variable is progressive.
    4) when the cursor is on the button it tells the mc to play r2. The mc now starts checking the cursor position.
    5) When moved out it tells the mc to play fr4.
    6) When the code has put it back in it´s place it tells itself to go back and stop on fr1.
    7) The button tells the mc what menu item it´s on.

    Here are some snippets to get you started.
    // for the button
    on (mouseOver) {
    pos = "100";
    with (block1) {
    gotoAndPlay (2);
    }
    }

    //code for the mc
    //code for fr1
    stop();
    // code for fr2
    xm = _root._xmouse;
    xc = this._x;
    dx = Math.abs(xc-xm);
    speed = Math.round(dx)/3;
    if (xm>xc) {
    this._x = this._x+speed;
    }
    if (xm<xc) {
    this._x = this._x-speed;
    }
    if (xc == _level0.pos) {
    gotoAndStop(1);
    }
    //code for fr3
    gotoAndPlay(2);
    // code for fr4
    dx = this._x;
    speed = Math.round(dx)/3;
    this._x = this._x-speed;
    if (xs == "0") {
    gotoAndStop(1);
    }
    //code for fr5
    gotoAndPlay(4);

    it´s not complete and has to be tweaked butt it should get you started. Let me know, cYa,
    Ivo.

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