A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: movieclip scale based on mouse position

Hybrid View

  1. #1
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429

    movieclip scale based on mouse position

    Hi guys, I'm working an OSX dock style menu. One where the item your touching grows to a certain size and the adjoining items blend their sizes. It's a verticle version btw. I'd like only the 2 nearest buttons above and below to blend

    It's looking good but I'm having trouble figuring out the math that will force the buttons scale to be inbetween %100 and %200.

    I want it so that when there is zero distance between the mouse and the button (rolled over the button), the button grows to %200 and as the mouse moves away it shrinks back to %100.

    I'll post the code I'm using atm if you want but I don't think it's the best way.

  2. #2
    Cheap Bear Imitation eRkLaErBaEr's Avatar
    Join Date
    Mar 2003
    Location
    Forests
    Posts
    308
    hope, i got you right.

    put that code on your button:
    code:

    on(rollOver){
    this.goal = 200;
    any_other_thing.goal = 50;
    }
    on(rollOut){
    this.goal = 100;
    any_other_thing.goal = 100;
    }
    /*this part controls the scaling
    just copy the script for _xscale
    the value 6 below determines the speed of scaling (depending on fps)*/
    onClipEvent(load) {
    var goal = _yscale;
    }
    onClipEvent(enterFrame) {
    _yscale+=(goal-_yscale)/6;
    }



    use this on your buttons, instance name "any_other_thing". scaling depends on the position of the things in it to the registration point. (if everything in it is put to center, it will scale equally to all sides, if it is set to the right, it will scale to the right. blah, guess you get the point. )
    Pink signature?


  3. #3
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    looks good man, I'm actually using the menu as a list of mouse listeners but I think using a goal variable rather than the static number I have now will do the trick. I'll have some time to mess with it in a couple hours. Thanks.

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