View Full Version : "Case" Statements
Marigold
September 7th, 2001, 10:48 PM
I'm working on a bunch of buttons that do different things depending on what the user has clicked before. Does anyone know if Case exists in Flash like it does in C++, or should I just use else If else If (and so on)?
upuaut8
September 7th, 2001, 11:53 PM
Can you explain what case statements do in C++?
thoriphes
September 8th, 2001, 12:14 AM
why don't you just give each button some on (release) event?
cases are also called switch statements. different things take place depending on the user's input
say i had 5 things i could do, a case would look like this:
//this is C++ now...
switch (choice)
{
case 1:
cout << "Do this" << endl;
break;
case 2:
cout << "Do this here" << endl;
break;
case 3:
cout << "What am i doing?" << endl;
break;
case 4:
cout << "???" << endl;
break;
case 5:
cout << "Finally, done!" << endl;
break;
default:
cout << "Not a valid answer" << endl;
break;}
see? it takes variable "choice" and it's value is tested here. if it's equal to 4, it would output "???", 5, "Finally, done!", etc.
upuaut8
September 8th, 2001, 02:14 AM
Sounds like it would be pretty easy to emulate that in flash.. simple functions/arrays/user imput calculations.
It would take some amount of scripting.. but mostly basic commands.. not anything too indepth.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.