how (AS Q)
- Started
- Last post
- 24 Responses
- fugged0
>> yeah, parseFloat would be fine too, but i wouldn't use parseInt.
I understand parseInt will provide you with only an integer and not a decimal. But, for this case, I think that's what he'd want.
- SteveJobs0
Number(4)
- stewart0
that easy.
i'll give it a try.
- stewart0
nope
- stewart0
parseFloat ?
- SteveJobs0
or just check it against =="4" since that's how the textfield is probably evaluating it anyway.
- SteveJobs0
should work:
Number(txtFld.text)==Number(4)
or
txtFld.text=="4"
- stewart0
well Jobs, that's my problem.
also with if ( textfield =="4" ) the value of the textfield is set to "4" instead of comparing it...
- CyBrainX0
Try: gotoAndPlay([textfield]);
- fugged0
use parseInt()
a = "3"
b = parseFloat(a)+1;
trace(b);output: 4.
>>also with if ( textfield =="4" ) the value of the textfield is set to "4" instead of comparing it...
shouldn't be if you are using == and not =. a single = causes an assignment where == and === are for evaluating an expression.
- Kuz0
shouldn't it be
if (textfield = 4) {
gotoAndPlay(2)
}??
- fugged0
mmm. need more coffee...
in my a/b example I meant to use parseInt. not parseFloat.
sorry.
- SteveJobs0
carefull with parseInt, it will truncate your decimals.
- unfittoprint0
parseFloat dat motherfucker!%"#"#
http://www.ourfamilynet.ws/forum…
b.i.a.t.c.h
- stewart0
uh
Steve,when i trace your
Number(this.textfield.text)
it results in 0but it displays "4"
weird.
i only want to be able to change a variable in an external .txt document, to use that variable in an if statement.
- JamesEngage0
parseInt always works for me... especially if yopu're reading from a text file... and there may be a line break after the 4 ?
- SteveJobs0
yeah, parseFloat would be fine too, but i wouldn't use parseInt.
- fusionpixel0
hey stewart, what is that IRC channel at? the #lfash channel
- stewart0
okay, here it is and it works.
http://pastebin.coconut.se/?id=3…thanks again!
- SteveJobs0
shorthand: