PDA

View Full Version : flash syntax



softeye
December 24th, 2009, 01:31 AM
hi,

I need help to understand the basic syntax.
like:
iXpos = (mouseX <= lo) ? xhi : xlo;
and
(this.trend == 0 ) ? (checkBoundary() ? 0.25 : -0.25) : (this.trend);

what "?" and ":" stands for

its kind of tricky to search for specific character syntax?:sigh:

thx,
Daniel

lope
December 24th, 2009, 01:41 AM
ternary operator

TheCanadian
December 24th, 2009, 03:03 AM
Shorthand if statement.

if(condition) doSomething
else doSomethingElse

is the same as

condition ? doSomething : doSomethingElse

Felixz
December 24th, 2009, 05:23 AM
var sth:String = otherVarIsNotNull ? otherVarIsNotNull : "var Was Null";

Shaedo
December 24th, 2009, 08:41 AM
of course a great summary of all of these things and more is available here:
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/operators.html

softeye
December 24th, 2009, 08:45 AM
Great!!! that explain a lot...
thx for the link and the quick replay
Daniel