Solved

Chane Button Color On press Actionscript

Posted on 2004-08-25
5
290 Views
Last Modified: 2012-05-05
How do I using Actionscript change the color of a button onPress? I have made the button and it has an over,up,down, and hit state, but I need to set its colour onPress. How is this done?  

0
Comment
Question by:jandhb
5 Comments
 
LVL 10

Expert Comment

by:muso120999
ID: 11897530
That's just the colour you set it to on the "down" frame (they are the same!).

or...

If you want the colour to change, and stay that colour when you release the mouse, then create a movieclip with 2 frames (frame 2 with the "onPress" colour) and put the code...

stop();

... in frame 1, and then call the movieclip something like "myButton"

and now put the following code on the new movieclip instance:

on(press){
      gotoAndStop(2);
}
0
 
LVL 1

Author Comment

by:jandhb
ID: 11897639
Maybe it would help to see what I have so far...

http://www.glennon.org/2004tour/tour.htm

When you click on say, "Ground" or any Floor for that matter I want it to stay that blue color so the user knows what floor they are on. How do I do that?


0
 
LVL 16

Expert Comment

by:ellandrd
ID: 11900281
does your btn change events have to be in actionscript? why not just create a button and have your different colors for each event that way??

its much easier than trying to use actionscript...

0
 
LVL 10

Accepted Solution

by:
muso120999 earned 25 total points
ID: 11900332
Okay, then I guess the simplest way (least coding) is to have 2 buttons (1 highlighted, and one normal), and when you click on "Ground" jump in the timeline to where you have the "highlighted" version.

or...

If you can't extend the timeline in this way for some reason, then you can make the "up" state of your button transparent (keep the text), and put a movieclip underneath (call this movieclip "highlight_ground", for example) and use the same 2 frame method as above...

You can then add the "on(press)" as above, but use code like this on the "ground" button (remember, the movieclip is behind it):
on(press){
     _root.highlight_ground.gotoAndStop(2);// go to the highlighted state
     _root.highlight_floor1.gotoAndStop(1);// go to the normal state
     _root.highlight_floor2.gotoAndStop(1);// go to the normal state
     _root.highlight_floor3.gotoAndStop(1);// go to the normal state
     _root.highlight_info.gotoAndStop(1);// go to the normal state
}

and for each of the buttons change the appropriate gotoAndStop to a 2.

Both ways you can use the normal functionality of the button, and have the highlight too.  There are other methods, but I feel these are the simplest.
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 11900936
a quick and easy would be to create a six frame movieclip, with movieclips instead of buttons - , where frame 1 is where nothing is selected, frame2 - ground is selected (i.e. blue) etc. - then name your movieclips intelligently, ie. button_01, button_02 etc so you can use a loop to reset if necessary, and to have 1 generic function to navigate.

blu.
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flash player plugin 13 7 333
How to display a webpage in a flash 10 361
How to determine issues pulling up internal device in browser. 5 87
Removing Flash from Website 6 65
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question