A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Question about menus and actionscript

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    3

    Question about menus and actionscript

    Okay, I dont have the action script to do this and I'm hoping I can explain this as best as possible to see if there is a way in action script to do this.

    Here is the movie I am working on:

    http://www.personal.kent.edu/~smarti...index_new.html

    My menu shows up "Print, 3d, Web"

    When someone clicks on the Print to get to the print page, i want "Print" to fade into a darker color, as well as a bar to go stationary behind Print. Now if someone clicks to go to another Page, for instance "Web" I want "print" to fade back to normal color, and have "Web" fade into a darker color,m as well as moving the bar to go behind "Web"

    I have been playing with movie clips, frame labels and tweens and it is turning into a huge amoutn of work and I'm assuming there has to be an easier way to control these things with action script.

    Any ideas?

    Also my nav (which is a movie clip with buttons nested inside) keeps restarting whenever i click on print, 3d, or web. That's a new problem.

  2. #2
    Senior Member
    Join Date
    Jun 2009
    Posts
    171
    AS2: You definitely want to use variables. It will solve all your problems.

    For example.... when click print_btn, disabled it [print_btn.enabled = false] and play the darkening animation within the movie clip [print_mc.gotoAndPlay(2)]. Then if you click any other button, enable print_btn and disable the respective & play the fade animation for BOTH buttons.

    This concept should get you moving.

    If all of this is new to you, I'll be happy to create a detailed tutorial.

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    3
    Sorry, forgot to mention this was in AS2, and dplows, variables are new to me. If you wouldn't mind creating a tutorial, that would be amazing.

  4. #4
    Senior Member
    Join Date
    Jun 2009
    Posts
    171
    For each button:
    Create a movie clip
    Frame 1 = normal state; stop action
    Frame 2-10 = darkening animation; stop action on frame 10
    Frame 11-18 = lightening animation; gotoAndStop(1) action on frame 18
    Go back to scene 1 and give it an instance name [ex: print_btn]

    On your frame on the main timeline...
    Code:
    stop();
    var myBtn:String = "";
    
    print_btn.onRelease = function(){
    	if(myBtn == "threed"){
    		threed_btn.gotoAndPlay(11);
    		print_btn.gotoAndPlay(2);
    		myBtn = "print";
    	}else if(myBtn == "web"){
    		web_btn.gotoAndPlay(11);
    		print_btn.gotoAndPlay(2);
    		myBtn = "print";
    	}
    }
    
    //repeat for threed_btn and web_btn, just copy & paste the print_btn function twice and alter it accordingly

  5. #5
    Junior Member
    Join Date
    Aug 2009
    Posts
    3
    Thanks very much for that, I will have to try it out after work.

    My only other question for now is what if I want the movable bar for each "page" as well. (I referred to it in an earlier post)

    Example:

    http://www.tutorialized.com/view/tut...Menu-Bar/39695

    See how the blue bar moves to which button you click on? How can i include that and control it with variables as well?

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