| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Mar 2001
Location: UK
Posts: 5
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
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. |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Mar 2001
Location: UK
Posts: 5
|
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] |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
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. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |