Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Active Button With Keystroke



Hi, I have a series of buttons already created so that when you rollover them, a short movie clip with an embeded sound plays. It works something like and animated keyboard. I would like to associated the buttons with keystrokes as well. This would would work so that when you press the button "A" the "A" key will play the movie that has the sound and animation in it.

Example:

(keypress A) My_A_button.State = "Rollover"
or
(keypress A) My_A_button.State = "Down"

I am using flash MX.



FlashKit > Flash Help > Flash General Help
Posted on: 05-06-2003, 11:35 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Button Using Keystroke
I want to make a keystroke (using "i") stop sounds and another keystoke (using "y") to activate the sound again. It will work in the movie, but not in the html. Does anyone know why it won't work when embedded in the html page?

How Can I Assign A Keystroke To A Button?
I'm using buttons to initiate actions, but I would prefer to simply make them invisible and respond to keystrokes. Can anyone help me out?

Activate A Button With A Keystroke
Hi, I have already created a series of buttons so that when you rollover them, a short movie clip with an embeded sound plays. It works something like and animated keyboard. I would like to associated the buttons with keystrokes as well. This would would work so that when you press the "A" key on the keyboard the "A" button will go in a "rollover" "down" state.

Example:

(keypress A) My_A_button.State = "Rollover"
or
(keypress A) My_A_button.State = "Down"

thanks for your help!

Making A Button Refresh? - Active Button
on (rollover) {
tar = tar +10;
}

When i use this on a button, is there any way to make it keep repeating? Such as as long as the mouse is over the button, it adds +10 in like second intervals?

Thank You,
-Dox'

Active Button
I'm trying to figure out how to keep a button in the over state when it's clicked and then go back to normal when another button is clicked.

Thanks for the help!

Active Button?
Hia there

What i want to do

I have a Button about me. When I click on the Button i will get the layer aboutme...Now the Button should stay white (active)...So you can see immediately where you are on the homepage...

How can I do that? Do I have to programm the Button?

Thanx for your help

adrian

[F8] Active Button
Why is it that when working in flash my buttons are active? they are cliclable. I would like to turn this off.
Could you please help? thanks
Ecinele

Button Still Active
hey guys

Promblem on my site:

link

"When you select an option in the portfolio section, the link you selected remains active when the content loads over it. Move the mouse pointer around over the white area to the left of the photo of the girl, you'll see what I mean."

I'm struggling to stop that happening - as the button that is causing the problem is within the sliding page - I can't take the sliding page out of that section of the movie as if I do when the user closes the portfolio section the sliding page will slide back to the "about" section - instead of returning to the portfolio main section which there were at (sliding page portfolio section)

I tried another way which was to add a solid colour over where the buttons would be to block them on the layer above the sliding pages - but that didn't work either

I have a feeling this is going to be a tricky one...hope somebody can help to solve this issue

Dips

Button 'ON' Or 'ACTIVE'
Hi. Buttons allow 'Up' , 'Over', 'Down' and 'Hit area' , but how do you show an 'ON' status or 'ACTIVE'. Say the user has pressed the button and you want to show that it it active after the user has released and moved the mouse off the button?

Active Button
is there a way to make a button inactive once is is pressed?

Active Url Button
Hi, I'm making a navigation for some html and php pages and was wondering if it would be possible for the flash file to detect the url so I can make the button "active" so the user knows where they are?

If I used the php $HTTP_SELF var and passed that to the flash file would that work?

Thanks very much for any help in advance.

El Kiwi

Active Button State
Hi all


Is there a way when you use a button, to make an "active" state, in other words, when it is clicked, it has a different state to over/down.
I can do it using tellTarget, where I have a completely different movieclip that overlayers over the button.

Secondly, what is the point of adding more frames to a button than the four it allready has.

thanks
J

Button Active When Another MC Is At A Certain Frame
I have a movieclip "bttn" with an invisible button over it. I'm using the following code on the button to get a smooth rollout on the movieclip

on (rollOver) {
bttn.play();
}
on (rollOut) {
cFrame = bttn._currentFrame;
bttn.gotoAndPlay(30-cFrame);
}

It has 29 frames so from frames 16 to 29 it plays the reverse of 1 to 15.

I have a stop command on 15. Basically I only want the onPress command to work when the MC "bttn" has stopped at frame 15.

What do I do? I've attached the .fla

REALLY appreciate any help

Making A Button Not Active
Hi there,

I masked out a button.Button1 makes the masked button visible.Button2 invisible.
When I hit button2 the button is still there but not visible how make this button inactive?

The cursor still finds the button and can hit it aldow the user can't see the button.

Big thx in advance,

Grtz

Having To Click On A Button Twice To Active
I am having a problem with my buttons.

For some reason i have to click on the buttons twice to get them to run the script.

The buttons are held two movies deep (movie within a movie within a movie) and the script is attached to the button to run with the mouse is released.

Its a pretty basic script, just telling the root movie to play and another movie to do something else.

The buttons and scripts work correctly but you have to click on the button twice for it to do so.

I am a fairly experienced flash user/scripter using Flash MX.

Is there something basic that i am missing?

Thanks

ds

Active State For Button.
Is it possible to have like the equivalent to a (html) active state for a flash button so that when you have clicked on a button and it loads the mov file the button colour changes and so that tells the user that section is currently active.

Hope this makes sense if not have a look at the mov. attached.

Active Button State?
http://www.sentcreations.com/mouseover/example.html

does anyone here know where a tutorial is on this for flashMX?

I tried searching but I don't think I know exactly what to type in the search field.

Anywho, can someone help me out?

thanks in advance.

Scrollpane And Button Active
I have a scrollpane, a movie clip which loads into it. this clip contains a few buttons. the scroll pane gives the buttons the hover and press states. I can controll these from they styles for the scrollpane fine. However there is no option for a active state that I could find. Is there any way to have an active state? I have tried everything I could think of and search high and low with no luck. so if I have three buttons and first is clicked it will remain as active till one of the others is clicked.

thanks dave

Active State Button
Hi all ...looking for a way to keep the button/movieclip in an active state
after hit but wih this its overrule with the out

any Idears

AS3
--------------------------------------------------------------


this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
this.addEventListener(MouseEvent.CLICK, onRelease);
this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);

function onMouseOver(e:MouseEvent){
e.target.gotoAndPlay("over");
}
function onMouseOut(e:MouseEvent){
e.target.gotoAndPlay("out");
}
function onRelease(e:MouseEvent){
e.target.gotoAndPlay("over");
}
function onMouseDown(e:MouseEvent){
e.target.gotoAndPlay("down");
}



-------------------------------------------


REGARDS

Active Button In Array Help~
Hi there

How can I make the active button stay at alpha 0.2 until another button is pressed?

or if there is an easier way of doing this please let me know!

PHP Code:



import caurina.transitions.*;var defy:Number = 133.0;var buttons:Array = [ bt1, bt2, bt3, bt4  ]; setupButtons( buttons ); function setupButtons( list:Array ):void{    var i:int = list.length;     while( i -- )    {        var button:MovieClip = list[ i ];        button.addEventListener( MouseEvent.ROLL_OVER, onButtonRollOver );        button.addEventListener( MouseEvent.ROLL_OUT, onButtonRollOut );        button.addEventListener( MouseEvent.MOUSE_DOWN, onButtonDown );        button.buttonMode = true;    }} function onButtonRollOver( e:MouseEvent ):void{    var button:MovieClip = MovieClip( e.currentTarget );    button.alpha = 0.5;} function onButtonRollOut( e:MouseEvent ):void{    var button:MovieClip = MovieClip( e.currentTarget );    button.alpha = 1;} function onButtonDown( e:MouseEvent ):void{    var button:MovieClip = MovieClip( e.currentTarget );    button.alpha = 0.2;}

Backgroup Button Is Active :-(
I am making window visible through action script (attachMovie). The movie is displayed fine no problem but the buttons which are suppose to be in the background are still action.

Can I make the button on the main page inactive till the new window is active?

Active Button State
Hi Guys,

Ive just built a audio player. everything works Spiffy. But I have one issue.

My mute button functions as should in terms of volume. However, I have two images.

a) the mute button without cross. - suggesting volume isnt muted.
b) the mute button with cross. - suggesting volume is muted.

How do I go about making the button image swap to the muted image when in that state. and swap back to the unmuted image when clicked again.

I hope that is clear enough.

Thanks heaps,

-etchit.

Active State Of A Button.
Hello,

I have five button that I animated through actionscript 3.0 and I am trying to set it up where once the file shows up one of the button that correspond to that page is active. Then whenever a user clicks on the other buttons the slide shows up and the button stays active. Here is my code that I have so far to see how everything is run.


Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

var slideTween:Tween;
var tabUpTween:Tween;
var tabDownTween:Tween;

// Setting the Movie Clip to buttonMode = true to have the hand cursor.
_nav_home_mc.buttonMode = true;
_nav_one_mc.buttonMode = true;
_nav_two_mc.buttonMode = true;
_nav_three_mc.buttonMode = true;
_nav_four_mc.buttonMode = true;

// Stop the animatating button
_nav_home_mc.stop();
_nav_one_mc.stop();
_nav_two_mc.stop();
_nav_three_mc.stop();
_nav_four_mc.stop();

var currentX: Number = 965;

// Home Button
function goHome(event:MouseEvent):void {
slideTween = new Tween(_all_mc,"x",Back.easeOut,currentX,965,1.5,true);
currentX = 965;
}

_nav_home_mc.addEventListener(MouseEvent.CLICK, goHome);
_nav_home_mc.addEventListener(MouseEvent.MOUSE_OVER, tabUp);
_nav_home_mc.addEventListener(MouseEvent.MOUSE_OUT, tabDown);


//One Button
function goOne(event:MouseEvent):void {
slideTween = new Tween(_all_mc,"x",Back.easeOut,currentX,0,1.5,true);
currentX = 0;
}

_nav_one_mc.addEventListener(MouseEvent.CLICK, goOne);
_nav_one_mc.addEventListener(MouseEvent.MOUSE_OVER, tabUp);
_nav_one_mc.addEventListener(MouseEvent.MOUSE_OUT, tabDown);


//Two Button
function goTwo(event:MouseEvent):void {
slideTween = new Tween(_all_mc,"x",Back.easeOut,currentX,-965,1.5,true);
currentX = -965;
}
_nav_two_mc.addEventListener(MouseEvent.CLICK, goTwo);
_nav_two_mc.addEventListener(MouseEvent.MOUSE_OVER, tabUp);
_nav_two_mc.addEventListener(MouseEvent.MOUSE_OUT, tabDown);


//Three
function goThree(event:MouseEvent):void {
slideTween = new Tween(_all_mc,"x",Back.easeOut,currentX,-1930,1.5,true);
currentX = -1930;
}
_nav_three_mc.addEventListener(MouseEvent.CLICK, goThree);
_nav_three_mc.addEventListener(MouseEvent.MOUSE_OVER, tabUp);
_nav_three_mc.addEventListener(MouseEvent.MOUSE_OUT, tabDown);


//Four Button
function goFour(event:MouseEvent):void {
slideTween = new Tween(_all_mc,"x",Back.easeOut,currentX,-2895,1.5,true);
currentX = -2895;
}
_nav_four_mc.addEventListener(MouseEvent.CLICK, goFour);
_nav_four_mc.addEventListener(MouseEvent.MOUSE_OVER, tabUp);
_nav_four_mc.addEventListener(MouseEvent.MOUSE_OUT, tabDown);


// Button Animation - Up and Down
function tabUp(event:MouseEvent):void {
tabUpTween = new Tween(event.target,"y",None.easeNone,event.target.y,203,.2,true);
}

function tabDown(event:MouseEvent):void {
tabDownTween = new Tween(event.target,"y",None.easeNone,event.target.y,209,.2,true);
}

Active State For MC / Button
Hi

This is driving me mad as it should be incredibly simple (been doing it in AS for years.) I have an MC that I’m using as a button. It has a background and label. For the MOUSE_OVER & MOUSE_OUT events I’m just changing the color of the label. For the CLICK event I’m changing the background color and making the label color the same as it’s MOUSE_OVER state. This all works fine except when I mouse off the button the MOUSE_OUT kicks in and makes my label the OFF color when I want it to remain the ON color. In AS2 I used to do this:

Section3Content.section_3_1_btn.enabled = false;

But this does not work. I’ve also tried:

Section3Content.section_3_1_btn.mouseEnabled = false;
Section3Content.section_3_1_btn.buttonMode = false;

But again this does not work. Please help … I’m going mad. Here is the full code:

///////////////////////////////////////////////////////////////////

Section3Content.section_3_1_btn.buttonMode = true;
//
Section3Content.section_3_1_btn.addEventListener(M ouseEvent.MOUSE_OVER, overSection_3_1);
function overSection_3_1(e:MouseEvent):void {

TintColor.addTint(Section3Content.section_3_1_btn. myLabel, 0xFFFFFF, 1);
}
//
Section3Content.section_3_1_btn.addEventListener(M ouseEvent.MOUSE_OUT, outSection_3_1);
function outSection_3_1(e:MouseEvent):void {
TintColor.addTint(Section3Content.section_3_1_btn. myLabel, 0x5C0E59, 1);
}
//


Section3Content.section_3_1_btn.addEventListener(M ouseEvent.CLICK, doSection_3_1);
function doSection_3_1(e:MouseEvent):void {

TintColor.addTint(Section3Content.section_3_1_btn. myLabel, 0xFFFFFF, 1);
TintColor.addTint(Section3Content.section_3_1_btn. myBackground, 0x921E6D, 1);
Section3Content.section_3_1_btn.mouseEnabled = false;
Section3Content.section_3_1_btn.enabled = false;
Section3Content.section_3_1_btn.buttonMode = false;

}
///////////////////////////////////////////////////////////////////


TIA
Paul

Button Not Active Outside Of Stage
This has been annoiying me for ages...
I have a movieclip that reacts to the cursor postion, but when the movie is embed into a browser such as firefox, i dont want the button to be active until the cursor has actully rolled over the flash movie as it seems to be active before the cursor has hit the actual flash object?!

Does that make sense?

Active Button Under Element
I have an information box displaying over some buttons. The buttons are still active underneath the box when the user hovers over different parts of the information box. How do I stop this from happening? The information box is in a layer above the buttons.





























Edited: 01/10/2007 at 06:35:49 AM by CompuStep

Make The Button Is Active...
hi
i am using five textboxes...
if all the texbox is filled then button need to make enabled...
i am used setfocus and killfocus.... but if i clicked the all textboxes whothout make an entry
then button become enabled

is there any other way to make button active when all the textbox is filled.....

~~Sk

How To Keep One Button In Active State
I'm working on a Flash touch screen app. I'd like to create buttons that maintain an active state while the user is on a certain screen.

How can I accomplish this quickly.

How To Keep Button Down State Active
Hi all

I'm a newbie to flash, however I've been able to create a navigation bar using flash buttons I have two different images one for the up state and another for the over and down state. Now the pages I'm creating are html not full flash. In Fireworks and Dreamweaver you are able to show the down state for the particular page you're on eg. home button highlighted on the home page, aboutus highlighted on the aboutus page.... you get the picture.

How do I do this in Flash, I've looked everywhere, there are references that you can do this with javascript similar to the Dreamweaver, Fireworks actions, which would be great, just change the script for each page, here is the script I found however it didn't give any other details except to place this in onload.
window.document.myFlash.SetVariable(button1, true);
however I have no idea how this is suppose to work, I changed the id of the flash to myFlash for the flash file I changed the button instance name to button1, however I think this is incorrect but don't know how else to reference the button.

Can anyone please help, I have searched these forums and Google but haven't found anything that would help, I might be dense and been searching for the wrong thing. But if anyone could assist I'd be much abliged.

Cheers

Button Inactive Then Active GET IT :D
Hi guys,

Well i'm not much of programmer more a designer but i want to master flash actionscript. Kinda figuring out stuff but its the logic that bugs me. I got in me brain but cant seem to type it on screen :S. I attached fla for more details.
I have 3 buttons. When u press(release) button nr1. it go's and stops a certian frame in a mc nested on its timeline. Now when i press (release) button nr2. i want button nr1. to go to ít's normal stat en button nr2. to gotoandPlay acertain frame in a mc nested within its timeline. this vice versa end for nr3 well i think u kinda now what i mean.

Please have a look and c what me doing wrong.
Greag Great thanks

How To Keep Button Down State Active
Hi all

I'm a newbie to flash, however I've been able to create a navigation bar using flash buttons I have two different images one for the up state and another for the over and down state. Now the pages I'm creating are html not full flash. In Fireworks and Dreamweaver you are able to show the down state for the particular page you're on eg. home button highlighted on the home page, aboutus highlighted on the aboutus page.... you get the picture.

How do I do this in Flash, I've looked everywhere, there are references that you can do this with javascript similar to the Dreamweaver, Fireworks actions, which would be great, just change the script for each page, here is the script I found however it didn't give any other details except to place this in onload.
window.document.myFlash.SetVariable(button1, true);
however I have no idea how this is suppose to work, I changed the id of the flash to myFlash for the flash file I changed the button instance name to button1, however I think this is incorrect but don't know how else to reference the button.

Can anyone please help, I have searched these forums and Google but haven't found anything that would help, I might be dense and been searching for the wrong thing. But if anyone could assist I'd be much abliged.

Cheers

Active Button Problem
I have some buttons on my website that I only want to be active when a certain variable is equal to a number. I don’t know how to write the code for it to look for the variable at any point within the movie clip. I can only get it to work on enterFrame or load, but the variable changes every time one of the navigation buttons is hit. What is the code that I need to write?

Thank you for your help.

This is what the original button script looks like.

ActionScript Code:
on (rollover) {
     mikepurdy._visible = true;
            var my_color:Color = new Color(butt_mike);
            my_color.setRGB(0x2F4F91);
}

Button Active Under Loaded MC
Help Please
I have an external SWF loading into an empty MC, buttons that the on the maintime line remain active underneath the Loaded MC

How can I make the buttons enabled once the SWF loads

or
How move the main timeline to a position where the button no longer exsist....so basically I want to click the button, load the movie and also make the main timeline move.

I am using the following code to load the SWF.....
on (release) {
loadMovie("1007.swf",_root.location);
}

Setting Active Button From Different Level?
I'm kinda stuck on this one..

I have my loadmovie at level0, my main content files load in at level1, my border/logo on level2 and my different sets of buttons at level3 and 4 (seperate due to some not always appearing, just figured it'd be easier)..

Now.. my question is.. with say the bottom buttons being level3, when I click on "Contact Us" or "About Us", and it loads the new movie into level1, how can I set the button I just clicked to remain active until another button is hit?

Is there a floating variable I can set and then change within the content level?

So you can see what I mean.. here is the site: http://www.1337designs.com/hgl

Thanks in advance..

Steve

Button Down State: Stay Active
Hi, I am creating a menu. When you mouse over the button it changes one shade, the mouse down it changes one more. I would like that when the buttaon is release the last state stays active. How would I do that?


Thanks

Keeping A Button Active Until Animation Is Done?
I need help on keeping a button active and moving until the animation is done...the problem I am trying to fix is on THIS SITE

Thanks,
WandMan

Keeping The Button Active When Jpg Loads. How?
I want to use mutiple copies of the same button over and over in an image gallery to load external jpg into an image container on the same stage. I also want the button to reamins in the "active" or "selected" or "down" position when the images is loaded. Is this possible using the action script?:

on (release) {
_root.container.loadMovie("myimage.jpg");
}
is there another way to do this so that when theimage loads the user knows which button they have just pushed and to go on to the next one?

Thank you for any help!!!!

Removing Active State From Button
Hi,
I'm currently working on a dynamic tab menu. I've managed to get everything working as it should with the exception of trying to remove the active state from a button. The problem arises when i click on another tab (non active), the non active tab goes to the active state howver i can't remove the active state from the original button.
Code below:

Code:
this.onRollOver = function()
{
if (this._name != "admin_tab_btn_"+_root.link) {
admin_button.gotoAndStop("over");
}
}

this.onRollOut = function()
{
if (this._name != "admin_tab_btn_"+_root.link) {
admin_button.gotoAndStop("up");
}
}

this.onRelease = function()
{
if (this._name != "admin_tab_btn_"+_root.link)
tab_name = this._name;
sub = new String( tab_name );
_root.link = sub.slice( 14 );
admin_button.gotoAndStop("active");
_root.administration_mc.gotoAndPlay("s"+_root.link);

}
}
stop();
The above code is on a frame. The frame also contains the movie admin_button. This movie has 4 frames. Frmae 1 is the default state for the button, frame 2 is labeled "over" and has the over state, frame 3 is labeled "up" and holds the rolloutside state and finally frame 4 which is labeled "active" an has the active state.

Any ideas as to where i might be going wrong?

Cheers

{F8} Button Active Area Control
I have button thats a movie, on rollover the button expands with some text below it, the problem is the active area of the button also enlarges , I want the active area to stay the same.

any ideas?
thanks
Ant

[F8] Making A Button Active And Inactive
Hi,

I was hoping someone here would be able to explain this code to me.


Code:
on (release) {
if (_root.i<>4) {
if (_root.i<>6) {
_root["item"+_root.i].i = 1;
_root["item"+_root.i].gotoAndPlay("s3");
_root.i = 4;
//_root.cont.gotoAndPlay("s1");
} else {
_root["item"+_root.i].gotoAndPlay("s2");
_root.i = 4;
for (j=1; j<5; j++) {
_root["item"+j].i = 1;
_root["item"+j].gotoAndPlay("s3");
}
}
_root.cont.swapDepths(50);
}
}


I purchased a flash template to learn from by altering it and playing with it. What I am trying to do is create multiple pages of one of the page it came with (the about us section). I was able to duplicate the page make changes to it and get a button to link to it. The problem I am having is that because I duplicate the about us page the button that links you back to the original about us page becomes in-active so I can't get to it from my new copied pages.

Anyway, the code above is what is on the about us button - I don't have a complete understanding of what the code is actually doing so, my question is, does this part of the code have the information I need in order to tell it not to become in-active or am I looking in the wrong place.

Any help would be great!

Thank you!

Xaria

[CS3] Make Button Active On FLV Load
Hi Everyone,

I am currtently working with a video player... see it here:

http://team.learn.com/files/upload/C.../IGT_demo.html

There is a problem. Because of our authoring tool and process we need to go with this format, one flv.

As you can see, if you click a button to watch a segment that hasnt buffered yet, the player locks until the buffer reaches that point.

Is there a way to make it so a navigation button won't be active until that part of the FLV has loaded, to prevent someone from choosing a button too far dwon the video buffer before it loads? Maybe make the buttons greyed out, and become active when the file has buffered enough to naviage?

My current script is here:

import flash.events.*;
import fl.video.*;

//-----------------
// CuePoints
//-----------------
display.addASCuePoint(
0.000,
"calendar",
{text:""}
);

display.addASCuePoint(
142.011,
"home",
{text:""}
);

display.addASCuePoint(
251.026,
"supervisor",
{text:""}
);

display.addASCuePoint(
341.025,
"management",
{text:""}
);

display.addASCuePoint(
529.000,
"reference",
{text:""}
);

display.addASCuePoint(
712.011,
"enrollments",
{text:""}
);

display.addASCuePoint(
755.017,
"assignments",
{text:""}
);

display.addASCuePoint(
1193.021,
"resources",
{text:""}
);

display.addASCuePoint(
1272.022,
"records",
{text:""}
);

display.addASCuePoint(
1354.015,
"sub",
{text:""}
);

display.addASCuePoint(
1741.027,
"whatwe",
{text:""}
);


//-----------------
// Video control assignment
//-----------------
// Use the skin assignment properties of the FLVPlayback
// instance to associate the controls with the player.

display.playPauseButton = play_btn;
display.stopButton = stop_btn;
display.seekBar = seek_bar;
display.volumeBar = volume_bar;
display.muteButton = mute_btn;
display.fullScreenButton = full_btn;

//-----------------
// Video event handling
//-----------------
// Create an event handler function to catch the
// cue event from the FLVPlayback instance.

function cuePointHandler( event:MetadataEvent ):void
{
// On cuePoint, look for a button named with the cue name
// plus "_btn". If it exists, then call its select method...
navigate(event.info.name, false);
}
display.addEventListener(MetadataEvent.CUE_POINT, cuePointHandler);

//-----------------
// Navigation / screen state
//-----------------

// Store the current button name
var currentBtn:*;
var currentBtnName:String = "";

function navigate( cueName:String, seekTo:Boolean ):void
{
// Handle previous button
var prev = getChildByName(currentBtnName);
if( prev != null ){
currentBtn.reset();
}
// Handle new button
var next = getChildByName(cueName+"_btn");
if( next != null ){
currentBtn = next;
currentBtn.select();
currentBtnName = cueName+"_btn";
}
// Seek to Cue Name
if( seekTo == true ){
var c = display.findCuePoint(cueName);
if( c != null ){
display.seekSeconds(c.time);
}
}
}

//-----------------
// Button event handling
//-----------------

// calendar_btn
function calendarHandler( event:MouseEvent ):void
{
navigate("calendar", true);
}
calendar_btn.addEventListener(MouseEvent.CLICK, calendarHandler);

// home_btn
function homeHandler( event:MouseEvent ):void
{
navigate("home", true);
}
home_btn.addEventListener(MouseEvent.CLICK, homeHandler);

// supervisor_btn
function supervisorHandler( event:MouseEvent ):void
{
navigate("supervisor", true);
}
supervisor_btn.addEventListener(MouseEvent.CLICK, supervisorHandler);

// management_btn
function managementHandler( event:MouseEvent ):void
{
navigate("management", true);
}
management_btn.addEventListener(MouseEvent.CLICK, managementHandler);

// reference_btn
function referenceHandler( event:MouseEvent ):void
{
navigate("reference", true);
}
reference_btn.addEventListener(MouseEvent.CLICK, referenceHandler);

// enrollments_btn
function enrollmentsHandler( event:MouseEvent ):void
{
navigate("enrollments", true);
}
enrollments_btn.addEventListener(MouseEvent.CLICK, enrollmentsHandler);

// assignments_btn
function assignmentsHandler( event:MouseEvent ):void
{
navigate("assignments", true);
}
assignments_btn.addEventListener(MouseEvent.CLICK, assignmentsHandler);

// resources_btn
function resourcesHandler( event:MouseEvent ):void
{
navigate("resources", true);
}
resources_btn.addEventListener(MouseEvent.CLICK, resourcesHandler);

// records_btn
function recordsHandler( event:MouseEvent ):void
{
navigate("records", true);
}
records_btn.addEventListener(MouseEvent.CLICK, recordsHandler);

// sub_btn
function subHandler( event:MouseEvent ):void
{
navigate("sub", true);
}
sub_btn.addEventListener(MouseEvent.CLICK, subHandler);

// whatwe_btn
function whatweHandler( event:MouseEvent ):void
{
navigate("whatwe", true);
}
whatwe_btn.addEventListener(MouseEvent.CLICK, whatweHandler);

[CS3] Button Show Active State
I have a nav button I want to show as "on" when you are on that page. The way I have been doing it is to make a movie clip of the button visible and cover the button on that page but that seams like a hack. Is therea better way?

Thanks -M

Active Button State And Intervals?
HI
I am having difficulty making a button
that dissapears when you press it..
only to return on stage again say ten seconds later
how do i work this damn setinterval thing?
i am pretty new to actionscript but am trying.
it is the setinterval i should be looking at right?
J

Active State Of A Button Problem
Hi everyone,

I've created 4 square buttons (square1_butt, square2_butt, square3_butt, square4_butt) and this the AS that I have put on square1_butt :

on (release) {
var colorful = new Color("square4_butt");
colorful.setRGB(0xFF0099);
}
on (release) {
var colorful = new Color("square2_butt");
colorful.setRGB(0xFF99CC);
}
on (release) {
var colorful = new Color("square3_butt");
colorful.setRGB(0xFF99CC);
}
on (release) {
var colorful = new Color("square1_butt");
colorful.setRGB(0xFF99CC);
}

It actually works, but it "disables" the original 4 states of the button (up, over, down, hit). Basically while releasing square1_butt I'd like the other buttons to return to their original color defined by the different other states of the button. Do anybody know how I can do that, "reset" ?

Thank you.

PS : I know my actionscript is super lame, but it's the only thing i came up with to do what I wanted to do...

Another--Menu Button Active State
I have been browsing trough 100´s of threads and i didn't really find a solution for my problem. I realize this do underline my lack of knowledge on this arrear, but somehow i don't think its all that complicated.
I got the hitTest and rewind methods of this site as well but combining it turned out bad

Im looking for a way to keep my button in an active state till the next button is pressed!

PHP Code:



_root.btn1.onMouseMove = function() 

   if(!this.hitTest(_root._xmouse, _root._ymouse, true)) 
    { rewind = true; }
}
_root.btn1.onEnterFrame = function(){
    if(rewind == true)
{  this.prevFrame(); }
}
_root.btn1.onRollOver = function(){
    rewind = false; 
    this.play();  }
_root.btn1.onRelease = function(){
        delete this.onRollOver;
        delete this.onMouseMove; } 




Now the button dos go inactive when pressed due to my brutal delete action on the functions on release>> But how do i make my "btn1" rewind and reactivate when a similar "btn2" is pressed. I have tried somewhat lame solutions by writing long if functions as well as assigning an active button var ...but no luck...
Any help appreciated ty

[AS2] Pdf Download & Active Button State
Hi all

Need help with 2 questions...

For a website how do I:
1. ActionScript2 - for a pdf file to download
2. ActionScript2 - for a button (text) in an active state?

Looking for very clear instructions...Thanks in advance to anyone helping this newbie!

Button Class Active Listener
Hi All
I have a cutom button class. it has a rollover , rollout and active states. I have 5 instances of this button in a container called container. What I want is when one puttone is in the in the active satate and another button is pressed it puts the first button in its default state, removes its active state. I used to do this in as2 by just looping through all buttons and returning them to default state onpress and onrelease I would set the new button to active. Not quite working in as3 also hoping there is a better way with a listener or something. read something about using prototype for this but cant find anything concrete. any help would be greate

Current Nav Button In Active State
Greetings kirupa people,

Can anyone explain how I would replicate the navigation on the following site: www.8dd.co.uk

It's very simple I know (like me with ActionScript!) but I have trawled the forums and can't find anything similar that I have managed to successfully work out for myself. For those that haven't looked at the example it is a menu with normal (grey text) and rollover/active states (red text). The current selected option should be disabled and on the active state until another option is selected. This serves to tell the viewer where they are without repeating it elsewhere.

Should this be a movieclip or buttons? Do I need framenames and actions to move the timeline?

Any help much appreciated oh wise ones...

Paul

Copyright © 2005-08 www.BigResource.com, All rights reserved