use onEnterFunc and onExitFunc