How i write the inline conditional statement in Flex with two expressions(case)
like
text="{expression, expression2 ? true:false}"
Flex compiler only check the first expression and on behalf of that give result.But i want to check both statement and show result. if no condition met then do nothing.
If I understand your question correctly either:
text = ((expression) && (expression2)) ? true : false;
or text = ((expression) || (expression2)) ? true : false;
[UPDATE 1]
Well I say either, but the first tests to see if both conditions are true, where as the second tests if either condition is true which I believe is the one you want.
[UPDATE 2]
An example
((1.1 is int) && (1.1 is Number)) ? true : false;
This will give you false as the expression (1.1 is int)
is false, and both expressions must be true to return true.
((1.1 is int) || (1.1 is Number)) ? true : false;
This will return true as the expression (1.1 is Number)
is true, and only one expression has to be true to return true.
[FINAL UPDATE]
Last example:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:VGroup>
<s:Label id="label1" text="{((1.1 is int) && (1.1 is Number)) ? 'true' : 'false'}"></s:Label>
<s:Label id="label2" text="{((1.1 is int) || (1.1 is Number)) ? 'true' : 'false'}"></s:Label>
</s:VGroup>
</s:Application>
Because you get an error if you use &&
alternatively you can use &&
.