added detach and attach methods for sprite objects