A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Movie Clip Button Question

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    160

    Movie Clip Button Question

    i have a menu with 5 different movie clips that i gave button functionality too.

    when you move over each button, there _xscale and _yscale values = 125 (so they grow bigger). when you move off of the they go back to their orignal size.

    my question is, how would i give them a hit state where they would stay at 125% until another button is hit then return to it's normal size? i would like to get this working so the visiter will know which section is currently selected.

    here is some example code i got working:

    on (rollOver, dragOver) {
    varOver= 1;
    }

    on (rollOut, dragOut) {
    varOver= 0;
    this.gotoAndPlay("_Out");
    }

    onClipEvent (load){
    varOver=9;
    }
    onClipEvent (enterFrame){

    if (varOver==1){
    _xscale=_xscale+(125-_xscale)/2;
    _yscale=_yscale+(125-_yscale)/2;
    }
    if (varOver==0){
    _xscale=_xscale+(100-_yscale)/6;
    _yscale=_yscale+(100-_yscale)/6;
    }
    }
    Last edited by addamtron; 01-07-2004 at 02:27 PM.

  2. #2
    Member
    Join Date
    Sep 2001
    Posts
    52
    If you attach this to each of your buttons, it will work for increasing and decreasing size on rollover. I did not know how you wanted to handle it if you have the first button expanded, and then you rollover the 2nd. Hopefully, this will give you enough to tweek and get the final effect. If not, let me know:

    on (rollOver, dragOver) {
    _parent.mc = this;
    }

    onClipEvent (enterFrame){

    if (_parent.mc == this){
    _xscale=_xscale+(125-_xscale)/2;
    _yscale=_yscale+(125-_yscale)/2;
    }
    else{
    _xscale=_xscale+(100-_yscale)/6;
    _yscale=_yscale+(100-_yscale)/6;
    }
    }

  3. #3
    Senior Member
    Join Date
    May 2003
    Posts
    160
    actually i wanted it to play an _Out animation i set up when you roll off the button.

    when you press the button, i want it to stay resized-- until another button is pressed.

    if you look at the animation i have working, the section title fills in with a redish color. i was trying to get it to tay filled in and resized on click.

    hopefully my attached sample file will make since thanks!
    Attached Files Attached Files

  4. #4
    Senior Member
    Join Date
    May 2003
    Posts
    160
    can anyone get this working with my sample file?

  5. #5
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    Did you get it working?

    _t
    I don't feel tardy.

  6. #6
    Senior Member
    Join Date
    May 2003
    Posts
    160
    as working as i got it is in the test file i attached a couple messages back.

    i got the button to stay in the sized position and go back to it's normal size when you mouse over another button, but what i want it to do is stay sized on click only and when you click another button, have the last button you pressed go back to it's normal size.

    another issue i'm having is getting the clicked button to stay filled in. the way it's set up, if you mouse over a button, i have it play an animation of the button getting filled in with a red color. when you mouse off the button, i have an animation play of the button unfilling itself.

    if you check my code on the test file i'm sure you'll see how it is working.

  7. #7
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    What you need to do is put a variable in your onPress function.

    For example:

    myButton.on(press){
    thisButton="yourButtonNameHere";
    if(thisButton!=_root.lastButton){
    _root[lastButton].someInstructionsHere;
    _root.lastButton=thisButton;
    }

    Put that or your version of that on each button.

    _t
    I don't feel tardy.

  8. #8
    Senior Member
    Join Date
    May 2003
    Posts
    160
    sorry can you please look at my code and repost the file with your version working. i'm just not getting it or something.

  9. #9
    Senior Member
    Join Date
    May 2003
    Posts
    160
    anyone? please help

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