|
|
|
#1 |
|
Junior Member
Join Date: Apr 2003
Location: UK
Posts: 14
|
Very quick if statement question.
Hi I have a very quick question about writing if statements.
When the user clicks a button I want h1 and h2 to either appear or dissapear depending on their current state, I can get just one to work (i.e. h1 on its own) but I don't know the correct syntax for two or even three variables. I've shown my code below, as you can see I thought a comma might work to separate the values but it doesn't.
Last edited by jbum; 10-01-2004 at 02:57 PM. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2004
Location: In a box outside of Safeway
Posts: 201
|
__________________
If computer games affected us, would I not be running into walls popping strange yellow pills and listening to repetitive music? Last edited by jbum; 10-01-2004 at 02:57 PM. |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Apr 2003
Location: UK
Posts: 14
|
That doesn't work mate. I assume you meant _visible instead of _visibility. Anyway I tried both methods and neither worked. Any more ideas on this one, I know its only a small thing, but I don't know the proper syntax in ActionScript.
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jul 2004
Location: In a box outside of Safeway
Posts: 201
|
EDIT: Edited some of the posts in this thread to use as tags - jbum
__________________
If computer games affected us, would I not be running into walls popping strange yellow pills and listening to repetitive music? Last edited by jbum; 10-01-2004 at 02:58 PM. |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
|
In my version of flash (MX 2004) the following code does not work:
If you do the above, y will be equal to 5, but x will be undefined. This implies that the example shown above, also using a comma, will also not work. The following does work, however:
As does this:
Personally, I would go with that last method - it's clearest. However, if you really want to save typing a few characters, at the expense of a little readability, by all means try this:
|
|
|
|
|
|
#6 |
|
Monkey Moderator
Join Date: Jul 2001
Location: UK
Posts: 2,038
|
if all you are doing is toggling the visibility then there is no need for an if statement anyway...
__________________
www.lexicon-design.co.uk If we aren't supposed to eat animals, then why are they made of meat? If Vegetarians like animals so much, why do they eat all their food? |
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|