Search code examples
apache-fleximageairblackberry-playbook

Playbook AIR SDK images on surface


I am trying to write a Playbook app using the AIR SDK, I need a surface of some kind that I can load a large image onto, then subsequently place some smaller images on top of and add the whole lot to a ScrollPane so I can pan it around the screen.

I have tried by adding the image to a sprite and displaying that in a group in the application but the image does not show up.

What is the correct surface kind I should be using here and how should I be loading the images? (currently using "Embed" and loading the image into a BitmapAsset.)

Thanks

EDIT:

        var scroll:ScrollPane = new ScrollPane();

        scroll.setScrollContent(image);
        scroll.update();

        scroll.graphics.beginBitmapFill(icon.bitmapData);
        scroll.graphics.drawRect(100,100,56,56);
        scroll.graphics.endFill();

        scroll.update();

This code causes a non-moving icon to be drawn behind the scrollContent, I want to add something on top of the scroll content that moves with it.


Solution

  • Rather than adding your images via the graphics api, you need to be adding components as I mentioned in the comment. Now that I know you're trying to use the QNX component set, the situation is a little different.

    What you need to do is stick with the QNX components if at all possible otherwise they may not get updated in the display list properly (like things being drawn in the background like you're experiencing)

    For the images you should be using something like this :

    var newImg : qnx.ui.display.Image = new qnx.ui.display.Image();
    newImage.setImage( youImgObj );
    

    For adding containers like you mentioned, you should be using (or similar) :

    qnx.ui.core.Container
    

    Then you should find things are drawn in a predictable order (last obj added is on top of stage).