sample code of Flipswitch.