I'm using a 2D text object to draw onto the view, and everything looks pretty good -- so long as I just display the text and leave it alone. i can move around, change my view, etc., and everything looks great.
The problem is: if I replace the text -- for example, if the text contains "time remaining: 15.07 sec" and I update every frame, the text "jitters" in the direction of the view's movement.
My basic logic for updating the text is:
1 2 3 4 5 6
| scene.addChild (newTextBG); if (oldTextBG != null) { oldTextBG.detach(); } oldTextBG = newTextBG; |
When I do this, every time the text updates, if I'm turning to the right, the text is off-to-the-left for 1 frame; if I turn to the left, it's off-to-the-right. Etc., if I'm moving fwd or backwards.
Again, I can move all around and everything's fine if I just leave the same text up there, not replacing it.
Any ideas what I'm doing wrong? Any hints?
Thanks!