Hi, this is a MIDP 2.0 issue. I have more than one Sprite that I wish to animate every 200 msecs or so.

I also have various strings I wish to write to the screen above (z-order) the LayerManager I am using.

To animate a sprite added to layerManager, I have to issue a call to layerManager.paint(..) to get the next frame to be written to the graphics buffer.

The code below handles animating just one sprite, and sets the layerManager's viewWindow just over that sprite. I am running into issues now as I'd like to set some 'ticker' style text above the layerManager and keep it ticking without having to flush the entire screen.

Are there any layers/sprites/string drawing strategies I could use to accomplish this?

My present code is:

Code:
public void run() {

        // boolean - always ensure that we repaint whenever we re-enter run();
        repaint = true;

        Thread mythread = Thread.currentThread();

        // Loop handling events
        while (mythread == canvasThread) {

            // check for keypad events
            // sets repaint to true if keypad event occurs
            drawMode( 0 );


            if (repaint) {

                // .. do positioning, setCelling stuff to layers in a LayerManager
                // .. do sprite positioning..
                // .. set strings and pos. to be written on top of layerManager

                // paint whole screen
                layerManager.setViewWindow( 0, 0, getWidth(), getHeight() );
                layerManager.paint( graphics, 0, 0 );

                // writes out strings to screen above layerManager
                writeStrings();

                // reset view window to 'small'
                layerManager.setViewWindow(
                        currentSprite.getX(),
                        currentSprite.getY(),
                        currentSprite.getWidth(),
                        currentSprite.getHeight() );


                repaint = false;


            } else { // not repainting

                // we have to issue a paint to get our darn sprite to animate
                layerManager.paint( graphics, currentSprite.getX(), currentSprite.getY() );

            }

            // get next frame in sprite
            currentSprite.nextFrame();

            // write buffered graphics to screen
            flushGraphics();

            try {
                mythread.sleep( panRate );
            } catch (java.lang.InterruptedException e) {
                ;
            }

        }

    }