Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > ActionScript Forums Group > Simple Stuff (Newbies)

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-07-2001, 09:06 AM   #1
Peter Rush
Registered User
 
Join Date: Mar 2001
Location: UK
Posts: 5
Default

Hi...

I have a movie with 20 buttons of which the user can select three. when a fourth is selected, the first one is deslected, when another is selected, the second is deslected and so on.

I have a variable (called 'clicked') which counts how many clicks, and each button has a variable which shows if it has been clicked.

What I can't do is work out what to do when the variable "clicked" is greater than 3.

Any help would be great.

Rushy
Peter Rush is offline   Reply With Quote
Old 03-07-2001, 09:42 AM   #2
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

I'm assuming your buttons are in MCs. So you can call your mcs 'button1', 'button2', etc, or name them in some numeric format. I'm also assuming you have some sort of MC structure where the 1st frame is the unselected version of the button graphic and the 2nd is the selected version.
Then each button could have this code:

_root:clickCount = _root:clickCount+1;
_root:selected = _root:selected+1;
_root["clickIndex"+_root:clickCount] = _name;
if (_root:selected>3) {
_root:selected = "3";
_root["clickIndex"+_root:clickCount-3].gotoAndStop(1);
}

That's just off the top of my head OK so if it doesn't work, don't be surprised, but it's the basic idea.

What it does:
- Incriments the counter which remembers how many buttons have been clicked
- Incriments the counter which shows how many are concurrently selected
- Sets the variable "clickIndex1" or 'clickIndex2', etc, to the name of the clip which was clicked. This part is keeping track of the order in which you clicked the buttons so we can unclick them in the same order.
- If the concurrently selected number > 3 we need to unselect one.
___- Rest the concurrent counter to 3.
___- Tell the 3rd last clip clicked (indicated by ["clickIndex"+_root:clickCount-3] ) to gotoAndStop it's unselected graphical state.

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder
Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Old 03-07-2001, 09:57 AM   #3
Peter Rush
Registered User
 
Join Date: Mar 2001
Location: UK
Posts: 5
Talking Multiple buttons

Thanks Jesse...

I think the code is exactly what I need but I am unsure at what point in the code to send my MC to frame 2 (it's selected state)

Rushy

[Edited by Jesse on 03-07-2001 at 05:15 PM]
Peter Rush is offline   Reply With Quote
Old 03-07-2001, 11:21 PM   #4
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

Sorry Peter I didn't include that in the button code
The code I gave was also wrong, which I relized last night while in bed but I was sure oyu wouldn't mind wainting till the morning to hear the changes.

OK this should work great:

on (release) {
this.gotoAndStop(2);
_root:clickCount = _root:clickCount+1;
_root:selected = _root:selected+1;
_root["clickIndex"+_root:clickCount] = _name;
if (_root:selected>3) {
_root:selected = "3";
_root.target = (eval(["clickIndex"+(_root:clickCount-3)]));
_root[_root.target].gotoAndStop(1);
}
}

Cheers

Jesse

PS - I deleted your other post and put it in here so that people following this thread can see the entire process.

__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder
Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scroll buttons for multiple dynamic text boxes Cordis ActionScript 1.0 (and below) 7 06-16-2006 12:58 AM
Multiple Arrays storing images as buttons norfy ActionScript 2.0 1 04-06-2006 11:37 PM
Using Function Parameters to Code Multiple Buttons denniscruz ActionScript 2.0 2 02-22-2005 04:17 AM
Multiple instances of buttons - easiest way - F5 deefadog Other Flash General Questions 20 03-13-2003 10:58 AM
multiple radio buttons roix ActionScript 1.0 (and below) 2 01-21-2003 05:56 AM


All times are GMT. The time now is 08:23 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.