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
Contributor
imrahil
Posts: 12
Registered: ‎01-16-2011
My Device: Z10 Limited Edition
Accepted Solution

How to use ApplicationMenu class

Hi, there is new class in SDK 3.2.0 - ApplicationMenu. Looks interesting, but how can I use it? Any examples available somewhere?
Developer
pyth
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: How to use ApplicationMenu class

*bump* I'm also interested. For those of you who haven't seen the API yet, here you go

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
SangramPatil
Posts: 271
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha

Re: How to use ApplicationMenu class

Have not installed the current SDK, but based on Actionbar code, this might work:

var oApplicationMenu:ApplicationMenu = new ApplicationMenu();
var oTabAction_1 = new TabAction("Action 1");
var oTabAction_2 = new TabAction("Action 2");
var oTabAction_3 = new TabAction("Action 3");
var oTabAction_4 = new TabAction("Action 4");
oApplicationMenu.addAction(oTabAction_1);
oApplicationMenu.addAction(oTabAction_2);
oApplicationMenu.addAction(oTabAction_3);
oApplicationMenu.addAction(oTabAction_4);
oApplicationMenu.addEventListener(ActionEvent.ACTION_SELECTED,fnActionSelected);
oApplicationMenu.y = stage.stageHeight - oApplicationMenu.height;
function fnActionSelected(e:ActionEvent):void
{
	trace("sTabName:: "+e.action.label);
}
addChild(oApplicationMenu);

 If it gives error with new TabAction, try with just Action!

 

Contributor
imrahil
Posts: 12
Registered: ‎01-16-2011
My Device: Z10 Limited Edition

Re: How to use ApplicationMenu class

[ Edited ]

SangramPatil wrote:

Have not installed the current SDK, but based on Actionbar code, this might work:

If it was that easy it would be great :smileyhappy:

and if SDK was open source it would be much easier to find out what to do with new classes...

 

your code unfortunately do nothing...

there is no code in SDK to slide this menu from top bezel and darken content of an app

(I know, because I decompiled SDK by myself and looked into sources...)

Developer
pyth
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: How to use ApplicationMenu class


imrahil wrote:

 

your code unfortunately do nothing...

there is no code in SDK to slide this menu from top bezel and darken content of an app

(I know, because I decompiled SDK by myself and looked into sources...)



correct. it would be great if the experience framework would be expanded with an example for this. Otherwise @imrahil, if that 's what you say is true, I guess we have to implement the movement and the darkening of the content ourselves. Luckily, the old

QNXApplication.qnxApplication.addEventListener(QNXApplicationEvent.SWIPE_DOWN, function(e:QNXApplicationEvent):void
			{
                //do stuff
			}
			);

 is still in the QNXDevice ANE :/

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
osus
Posts: 217
Registered: ‎04-26-2012
My Device: Z10

Re: How to use ApplicationMenu class

This is how I have it working (full sample):

 

 

		var appMenu:ApplicationMenu=new ApplicationMenu();
		appMenu.width=stage.stageWidth;
		appMenu.helpAction=new Action(bundle.getResource("help"), Icons.help, 6);
		appMenu.settingsAction=new Action(bundle.getResource("settings"), Icons.settings, 7);
		appMenu.addEventListener(ActionEvent.ACTION_SELECTED, actionSelected);
		QNXApplication.qnxApplication.addEventListener(QNXApplicationEvent.SWIPE_DOWN, onApplicationSwipeDown);
		
		
		private function actionSelected(e:ActionEvent):void{
			trace("ACTIONSELECT "+e.action.data);
			switch(e.action.data){
				case 6: //help
					break;
                                case 7: //settings 
break;
} } private function onApplicationSwipeDown(event:QNXApplicationEvent) : void { var to:int=0; if(this.contains(appMenu)){ to = -appMenu.height; }else{ appMenu.y=-appMenu.height; this.addChild(appMenu); to = 0; } Tweener.addTween(appMenu, {y: to, time: 0.5, transition:"linear", onComplete: function():void{ if(appMenu.y<0){ removeChild(appMenu); } }, onUpdate: function():void{ maincontainer.y=maincontainer.y=appMenu.y+appMenu.height; }}); }

 

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords
Developer
pyth
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: How to use ApplicationMenu class

great stuff!. combining this with a black layer (added and removed like the appMenu), whose alpha value is set onUpdate (sth. like blackLayer.alpha = (1 - Math.abs(appMenu.y/appMenu.height)) * 0.8 ), and there you have your code. :smileyhappy:

 

@jDolce you could add this to the experience framework ^^

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Contributor
imrahil
Posts: 12
Registered: ‎01-16-2011
My Device: Z10 Limited Edition

Re: How to use ApplicationMenu class

[ Edited ]

you guys rock! it works like a charm now! :smileyhappy:

 

I just added some minor tweaks: changed tween time to 0.2 and alpha to  0.5