A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Button query

  1. #1
    Junior Member
    Join Date
    Oct 2001
    Location
    Derby, UK
    Posts
    22

    Button query

    Hi

    I was wondering whether it would be possible for you to point me in the right direction with a button problem that I am currently having.
    I recently went on a website called http://www.frosch-studio.com/ and liked the way their buttons worked.

    I would like to something similar, I can deal with the states of each button, but where my problem lies is that when a button is clicked and the assigned movie clip is loaded. How do I make sure that the same button now becomes in active, because at the moment it keep loading the same movie clip again when its clicked.

    I know that it is a matter of actionscripting, but can anyone recommend me a book, link or example please

    Tony in advance

  2. #2
    ReMember jennyj's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    549
    Using MX, button movieclips:

    create a movie clip, give it 4 keyframes, give the 4 keyframes frame labels as follows:- "_up" "_over" "_down" "disabled" Make each keyframe look however you want.

    drag the buttonmovieclip onto the stage, give it an instance name ( I am using an instance name of "home")
    do the same for your next button(this one has an instance name of "clips")

    code on main timeline

    Code:
    function reset(){
    home.enabled = true;
    home.gotoAndStop("_up");
    clips.enabled = true;
    clips.gotoAndStop(_"up");
    }
    home.onRelease=function(){
    reset();
    this.gotoAndStop("disabled");
    _root.gotoAndStop("home");//this tell the main timeline
    //to go to a framelabel called "home", you could change it to
    //_root.attachMovie("movieclip", 2)
    //or something similar
    this.enabled = false;
    };
    clips.onRelease=function(){
    reset();
    this.gotoAndStop("disabled");
    _root.gotoAndStop("clips");
    this.enabled = false;
    };
    you now have two buttons on your stage. If you click on "home", that button will be disabled, and the main time line will go to a framelabel of "home" (see the comments in the code)


    a couple of good resources: Actionscript for Flash MX, the definitive guide - Colin Moock, published by O'reilly
    flash MX upgrade essentials - Sham Bhangal, published by friends of ed

    JennyJ

  3. #3
    Junior Member
    Join Date
    Oct 2001
    Location
    Derby, UK
    Posts
    22

    thanks

    Thank you, thank you and thank you!

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