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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Regular Contributor
Posts: 58
Registered: ‎10-21-2010
My Device: Bold 9700
My Carrier: DTAC
Accepted Solution

Change Page Problem

Hi everyone ,

I have to tell you guys that I'm a new Adobe Air developer. So I created my application which have 2 class.

Both of them have children like button ,textfiled .

I want to do when I click at a button in  1 class it's supposed to call another page in the other class via mouse event.

 

I dont know how to do this. I means how to call another screen ? Does it like  push and pop screen  in Blackberry Java development ?

 

Can anyone tell me or show me some code ?

 

Thanks,

Regards

 

 

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

Re: Change Page Problem

[ Edited ]

hey Jutikorn,

 

What you can do is have one main class say Class 1 and have a sub class say Class 2. In your main class when someone clicks on the button (say btnOne) you can call a function in your main class (Class 1) that creates a new instance of Class 2 like:

 

 

btnOne.addEventListener(MouseEvent.CLICK, addNewScreen);

 

 

which then calls the function addNewScreen():

 

 

public function addNewScreen(e:MouseEvent):void
{
     var screenTwo:Class2 = new Class2();
     addChild(screenTwo);
}

 

this then adds all the objects of your Class 2 to your Main class (Class 1) screen. hope that helps!

 

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
Regular Contributor
Posts: 58
Registered: ‎10-21-2010
My Device: Bold 9700
My Carrier: DTAC

Re: Change Page Problem

Hi JRab

 

Thanks for your reply,

 

What does screenTwo type . I guess I have to extends Class2 with Sprite , right ?

 

Thanks

Regards

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

Re: Change Page Problem

No Problem! and yes your class2 would extend the Sprite class. That way you can place a different set of objects just as you would in your main class. So think of it as two pages of something. Every page you create would be a sprite.

 

there is also the container class and such but i havent quite grasp the concept of that. seems all too unnecessary... sprites do the same thing but are simpler... but maybe i just havent dove into it enough.

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
Developer
Posts: 137
Registered: ‎10-26-2010
My Device: Bold 9900 + PlayBook
My Carrier: Rogers

Re: Change Page Problem

[ Edited ]

The Container class compliments Sprite, it doesn't replace it. You use Containers to lay out content within a Sprite, or within other Containers. It's better than setting absolute X and Y values as it works for different screen resolutions, aspect ratios, etc.

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

Re: Change Page Problem

yeah but the way i look at it the playbook is going to be one size for a long time. i think i have enuff time before i have to know containers inside and out haha. jk but i'll figure it out eventually just in case the orientation of playbook comes into play.

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
Developer
Posts: 137
Registered: ‎10-26-2010
My Device: Bold 9900 + PlayBook
My Carrier: Rogers

Re: Change Page Problem

I wouldn't count on that. Rumours have been strong that the next generation of Storm (LTE-enabled) will have a QNX based OS. I say "QNX based" because the rumours predate the PlayBook announcement by months, before we knew it was called Tablet OS.
--------
Taylor Byrnes
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Change Page Problem

I wouldn't hold my breath. Don't get me wrong, I love RIM to death and will with them for the long run but I highly doubt the Storm will have anything QNX based. It will have OS6 at best. Right now it barely made it to the OS5 upgrade. I don't think it'd jump so far ahead that it'd get supercharged with QNX. But if I'm wrong, and I hope I am, QNX + Storm would be an awesome mix.
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