helper function to flick an element