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
Highlighted
Regular Contributor
Posts: 90
Registered: ‎09-04-2009
My Device: Blackberry Z10
My Carrier: Airtel
Accepted Solution

Navigate screens

hello everyone,

 

How to navigate one screen to another screen means how to add another sprite.

 

 

Thanks,

Satish

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Navigate screens

[ Edited ]

hey satish,

 

this has been discussed several times in the forums. basically there is no concept of screens just a manipulation of children within the application. once you want to add a new "screen" you would simply do the addChild() function and when you want to remove a "screen" from view you would do a removeChild() function. below is a simple example illustrating the technique:

 

Page1.as

 

package
{
	//Remember to import all of the classes that you
	//are using
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import qnx.ui.buttons.LabelButton;
	
	// The following metadata specifies the size and properties of the canvas that
	// this application should occupy on the BlackBerry PlayBook screen.
	[SWF(width="1024", height="600", backgroundColor="#FFF000", frameRate="30")]
	public class Page1 extends Sprite
	{
		private var page2:Page2;
		
		public function Page1()
		{
			//initiate new object here to use later
			page2 = new Page2();
			
			var labButton:LabelButton = new LabelButton();
			
			labButton.label = "Click";
			labButton.setPosition(10,50);
			labButton.addEventListener(MouseEvent.CLICK,dothis);
			
			addChild(labButton);
			
			stage.nativeWindow.visible = true;
		}
		//change the event to MouseEvent since that is what you
		//are listening for
		public function dothis(event:MouseEvent):void {
			
			addChild(page2);
			
		}   
	}
}

 

 

Page2.as

 

package
{
	import flash.display.Sprite;
	
	import qnx.ui.buttons.LabelButton;
	
	public class Page2 extends Sprite
	{
		public function Page2()
		{
			var label:LabelButton = new LabelButton();
			label.label = "Welcome to Second Page";
			addChild(label);
		}
	}
}

 

 

for more details about this particular program go here:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/How-to-navigate-to-other-page/m-p...

 

and for additional resources dealing with this topic, go here:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Effects-in-Playbook/m-p/671639#M2...

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Creating-seperate-screens/m-p/636...

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/how-to-add-new-screen/m-p/627841#...

 

hope that helps. good luck!

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