You can not do this using flex or the iOS SDK. You can, however, enable AssistiveTouch by going into Settings -> General -> Accessibility -> AssistiveTouch
which will put a little button on your screen that when tapped will allow you to lock your device