Solved

Chane Button Color On press Actionscript

Posted on 2004-08-25
5
280 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Some Flash in IE doesn't display properly, but does in Chrome 4 619
Action Script commands 3 212
Adobe Indesign CS6 4 96
Play RTMP without Flash 3 409
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now