Flash Conditional Operator
Posted At : April 4, 2007 9:13 AM
| Posted By : Dave
Related Categories:
Flash
I was working on a flash application and wanted to concatenate a piece of static text with dynamic text. Instead of writing out this whole long thing to do it I figured I could pull it of using a conditional operator. For those that are unfamiliar a conditional operator in flash looks like this:
var y:Number = 10;
var z = (x < 6) ? x: y;
trace (z); // returns 5
So. This is what my code looked like. Taking a static piece of text and adding a conditional dynamic piece to the end.
However no matter what the var selAction actually was the text for action_lbl was always "In".
After doing some digging I found out that a conditional operator used in this fashion will always fail. I wrote a little test to confirm.
trace(thisTrace); // returns "var 1";
Now after all this I am back to where I started.
--Dave

There are no comments for this entry.
[Add Comment]