Posted By

weavermedia on 01/11/10


Tagged

flash as3


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

weavermedia
Demian
jhoard
adrianparr
tspitzr


Conditional shorthand Flash AS3


 / Published in: ActionScript 3
 

  1. // buttonState is String, pressed is Boolean
  2.  
  3. // String is "on" if pressed is true, otherwise it's "off"
  4. var buttonState:String = (pressed) ? "on" : "off"
  5.  
  6. // pressed is true if buttonState string matches "on" otherwise it's false
  7. var pressed:Boolean = (buttonState=="on") ? true : false

Report this snippet  

You need to login to post a comment.