Welcome!

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

Reply
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: how to go next and and previous page

I might be able to look at this later on today.  I'm on another project right now.  If someone else gets to it first, great.

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: how to go next and and previous page

Here is a FB4 project file that can be imported that show a basic 2 page application using the PageViewStack class along with a singleton class as a bridge to communicate via the main view.  the FXP file has been ZIPped up to allow for it to be uploaded.

Super Contributor
Posts: 306
Registered: ‎08-10-2010
My Device: Not Specified

Re: how to go next and and previous page

sorry for late reply

i paste the code here for navigation of screen

it is just demo which i make it for navigation

package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.events.ProgressEvent;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import qnx.ui.buttons.Button;
    import qnx.ui.text.Label;
    import qnx.ui.text.TextInput;
    import qnx.ui.theme.ThemeGlobals;
    
    
    
    [SWF(width="1024", height="600", backgroundColor="#BBBBBB", frameRate="30")]
    public class UIComponentDemo extends Sprite
    {
        
        public function UIComponentDemo()
        {
            super();
//            stage.align = StageAlign.TOP_LEFT;
//            stage.scaleMode = StageScaleMode.NO_SCALE;

            ThemeGlobals.currentTheme = ThemeGlobals.WHITE;
            
            // Format the Button Text
            var textFormat:TextFormat = new TextFormat();
            textFormat.align = "center";
            textFormat.font = "Comic Sans MS";
            textFormat.size = 20;
            textFormat.color = 0x000000;
            textFormat.italic = false;
            textFormat.bold = false;
            
            var manageText:TextField = new TextField();
            manageText.text ="First";
            manageText.width = 150;
            manageText.height = 50;
            manageText.setTextFormat(textFormat);


            var submit:Button = new Button();
            submit.addChild(manageText);
            submit.x = 200;
            submit.y = 100;
            submit.addEventListener(MouseEvent.CLICK,onClcikSubmit);
            addChild(submit);
        }
    public function onClcikSubmit(e:Event):void{
            stage.addChild(new UIComponentUSe());
            stage.removeChild(this);

        }
    }
}

package
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import qnx.ui.core.UIComponent;
    import qnx.ui.display.Image;

   import qnx.ui.buttons.CheckBox;

    public class UIComponentUSe extends Sprite
    {
        public function UIComponentUSe()
        {        
           var checkBox:CheckBox = new CheckBox();
            checkBox.x = 100;
            checkBox.y = 100;
            checkBox.label = "Blackberry";
            checkBox.height = 100;
            checkBox.width = 200;
            checkBox.addEventListener(MouseEvent.CLICK,onClickCheckBox);
            addChild(checkBox);
        }
        public function onClickCheckBox(e:MouseEvent):void{
            this.parent.addChild(new UIComponentDemo());
            removeChild(this);

        }
        }
    }

Contributor
Posts: 31
Registered: ‎01-27-2011
My Device: Tablet

Re: how to go next and and previous page

Thanx jtegen

u solved my problem.

Highlighted
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: how to go next and and previous page

And no kudo?  Tough crowd.Smiley Sad

Developer
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: how to go next and and previous page

Not my thread, but thanks for this, am expanding my app to multiple screens and this will do the trick. You get a kudo from me at least Smiley Happy

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Developer
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: how to go next and and previous page

Ok I do have a question about this John - What would the GotoPage3 function look like if I want to add a third (or fifth, etc) page? Still trying to wrap my head around this library and I can't find documentation on this part.

 

Thanks

R

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: how to go next and and previous page

Sorry for the lack of documentation on this class.  There is not too many API that need to be known.  You can have any number of pages and you can goto any page from any page in any direction.  Just keep calling addChild() to add pages and then you just need to add the controls in a page or in an application bar to go from one page to another.  Hope that helps.

Developer
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: how to go next and and previous page

Thanks - I will play with it again and see what I can sort out Smiley Happy My confusion is more in the ShowPageX function as to what the PageViewStack.RIGHT_LEFT part should be as you add pages, is this just where the page enters from?

 

Lack of documentation isn't a huge problem, happens with a lot of projects and in this case getting this great lib out without complete docs is way better than waiting for documentation!

R

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: how to go next and and previous page

PageViewStack.RIGHT_LEFT is saying I want to show page X and have it enter from right to left.  It is done here to allow the developer to decide the layout of all the pages.  Maybe all pages (round robin) enter from the right.  Or maybe page 2 enters from the right but to get back to page 1, that enters from the left.  Or maybe these is some symbology to have some pages go left and right and some pages to go up and down.  Maybe something like:

 

[ HOME ] [ PAGE 1 ] [ PAGE 2 ]

                    [ PAGE 3 ] [ PAGE 4 ]

Hope that helps.