Conditional shorthand Flash AS3

/ Published in: ActionScript 3
Save to your folder(s)

Copy this code and paste it in your HTML
  1. // buttonState is String, pressed is Boolean
  3. // String is "on" if pressed is true, otherwise it's "off"
  4. var buttonState:String = (pressed) ? "on" : "off"
  6. // pressed is true if buttonState string matches "on" otherwise it's false
  7. var pressed:Boolean = (buttonState=="on") ? true : false

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.