Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Posts: 297
Registered: ‎10-30-2010
My Device: PlayBook
My Carrier: other

Container Border / Outline and component autoFit

Is there a way to enable container 'outlines' / rounded black border?


Also, When placing a component inside a container, is there a way to make it 'autofit' within the margins specified for the container?

Posts: 192
Registered: ‎09-23-2009
My Device: 9860/PlayBook/Dev Alpha
My Carrier: Plus GSM

Re: Container Border / Outline and component autoFit



To make it 'Fit' make it size at 100% (size = 100; sizeUnit = SizeUnit.PERCENT). There is no way to skin Container (or I didn't found it , JRab will check this for sure Smiley Wink ). I have done my backgrounds for containers by creating class like this:



    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Matrix;

    import qnx.ui.core.Containment;
    import qnx.ui.core.SizeMode;
    import qnx.ui.core.SizeUnit;
    import qnx.ui.core.UIComponent;

    public class NiceBackground extends UIComponent
        public function NiceBackground()
            //use graphics object here to draw background
            //withh gradients, filling and others
            //or just init and do all drawings in draw()
            this.containment = Containment.BACKGROUND;
            this.size = 100;
            this.sizeMode = SizeMode.BOTH;
            this.sizeUnit = SizeUnit.PERCENT;

        override public function draw():void
           //this function is called when width or height
           //of component has changed, use it to redraw background 
           //or to recalculate round borders



Later I'm adding my background to component by simply calling this code on container:



addChild(new NiceBackground());


Simple as is - you have full power on display and behaviour.


Found my post helpfull? Like it! It solves your trouble? Help others and accept it as solution. Search before asking.
My apps: Secret Cod3s | Should my tablet be banned?
Jakub Nietrzeba
PGS Software S.A.
Your reliable partner in Poland - IT Outsourcing - BlackBerry, iPhone, Web and Standalone applications
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Container Border / Outline and component autoFit

haha! Smiley Happy


no need, you took the words right out of my mouth (or keyboard). alrite that was cheesy but yeah applying an actual background image to your container is going to be your best bet. the other way is to make your own container and make it "skinnable". but that'd be a little involved. id stick with the background image.

J. Rab (Blog) (Twitter)
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman