[quoted text, click to view] > OK my assignment idea there is all wrong. Not sure how to
> assign these properties correctly within my application...
Yeah, I was a bit confused. I'll get back to that in a minute.
[quoted text, click to view] > BTW is this forum application really buggy or what? I just
> tried to post and it was lost somewhere along the way...
> Happens all the time to me, and tons of ColdFusion errors
> during routine use.
I recommend using the NNTP feed instead. The web interface *is*
frustrating. Fire up Outlook Express or Thunderbird and head to
forums.macromedia.com instead.
As for your assignments:
[quoted text, click to view] > outerRadius = Number(outerRadius_txt.text) = 100;
The reason this won't work (I believe) is because assignments work from
right to left. 100 will be assigned to the .text property of
outerRadius_txt, which in turn will be assigned to outerRadius. In this
context, I'm not sure how the Number() function works ... I think it just
doesn't make sense here. But in any case, outerRadius will always equal a
hundred here.
If you simply want outerRadius to equal the value of outerRadius_txt, do
this:
outerRadius = Number(outerRadius_txt.text);
If you want outerRadius to equal the value of outerRadius_txt *only if
it has a value,* and 100 if it doesn't, do this:
// either this, using the ternary operator
outerRadius = (outerRadius_txt.text != "") ? Number(outerRadius_txt.text) :
100;
// or this, which is equivalent
if (outerRadius_txt.text != "") {
outerRadius = Number(outerRadius_txt.text);
} else {
outerRadius = 100;
}
Note that neither of these tests whether the value of outerRadius_txt's
text property is a valid number. Users *might* enter a string, like "asdf".
What then?
You might experiment with the parseInt() or parseFloat() functions.
if (outerRadius_txt.text != "") {
if (parseFloat(outerRadius_txt.text) > 0) {
outerRadius = Number(outerRadius_txt.text);
// or outerRadius = parseFloat(outerRadius_txt.text);
}
} else {
outerRadius = 100;
}
... or maybe ...
if (outerRadius_txt.text != "") {
if (!isNaN(parseFloat(outerRadius_txt.text))) {
outerRadius = Number(outerRadius_txt.text);
}
} else {
outerRadius = 100;
}
David
stiller (at) quip (dot) net
"Luck is the residue of good design."