This is a discussion on "If Statements..." within the Flash & Multimedia Forum section. This forum, and the thread "If Statements... are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
If Statements...
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
If Statements...
Hey Karl. here's my problem. No matter what kind of If statement I use and no matter if x is actually = to the 22 or not.... it always does everything anyways. FE - if I have this:
|
|
|
|
#2
|
|||
|
|||
|
Because your code is weird.
Why do you have x=20; and Else; they shouldn't have ; after them. Statements should, like Attack = Attack + 20; Actionscript also doesn't use End If; it uses if (condition) { // do something } that's it. |
|
#3
|
|||
|
|||
|
It gives me an error if I pull out the ';' and it also errors and tells me I need to put End If; if I leave it off... WHAT THE HECK IS WRONG!
|
|
#4
|
|||
|
|||
|
The code should be this:
if (x == 20){ Attack = Attack + 20; } else { Attack = Attack - 10; } First off, your equal signs need to be double equals when checking for equality, otherwise it is like setting x equal to 20. Second, you are placing the semi-colons in the wrong places. Semi-colons only need to be after command statements. In other words, if it is the start of a function, or checking for equality... you dont need a semicolon. This is sort of a hard concept to explain, but for the record, the code I gave you should work. |
|
#5
|
|||
|
|||
|
Ahh thanks man
|
|
#6
|
|||
|
|||
|
No problem :-) I owed ya one for the navigation menu help!
|
![]() |
| Tags |
| statements |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Response.write if statements in a form? | natalief2008 | Classic ASP | 1 | May 5th, 2008 21:58 |