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
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Swipe Down Event

that might be it. try creating a new project using Flex Mobile Project instead and just try the swipe down on it and then push it into the playbook simulator.

 

also were you able to test on the simulator with this app prior to attempting the Swipe Down ?

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
JohnPinkerton
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)

Re: Swipe Down Event

Yes, prior to attempting to Swipe Down it loaded fine in simulator. Still does, just the Swipe Down doesn't work.

I bet if I did a new Action Script project, I'd be able to use those demos just fine. I thought I could just import and go with em.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Swipe Down Event

 


JohnPinkerton wrote:
Yes, prior to attempting to Swipe Down it loaded fine in simulator. Still does, just the Swipe Down doesn't work.

I wouldn't be too sure.  If it isn't even building a .bar file in debug mode, I'm puzzled how (and whether) it could be building a .bar file in normal mode.

 

 

Is there any chance that it's actually failing to build anything new in either case, but is installing some old .bar file that doens't have any of the swipe stuff in it?  People using IDEs that they're not too familiar with often get caught by things like that, in my experience.  (One reason I try to avoid them most of the time.)

 

(The best way to check that is to change some prominent text string in your source, rebuild, and reinstall.  If you see that unique string you're definitely succeeding at building it that way... then change the string to yet another new one and try again in debug mode, being sure nothing else has changed.)


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
JohnPinkerton
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)

Re: Swipe Down Event

Yeah, I had a problem once before of my app not actually building (JRad helped me through that one! :smileyhappy:)

 

Just to be sure, I've moved buttons around and changed some background colors during all this.

 

Would it be possible to do a majority of the imports/functions without having to do actionscript import?

 

I started out doing a lot in design mode for the layout, but have switched over to now working mostly in source view.

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

Re: Swipe Down Event

hey johnp,

 

unfortunately the one of the things that seperates AS3 structure from flex is that you have to do explicit imports. i think in flex you can use a majority of mx / spark library with namespaces and without importing anything. you get used to it after a while though - great discipline :smileyhappy:

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
JohnPinkerton
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)

Re: Swipe Down Event

So not giving up easily I've been constantly still trying to make this work.

 

I found this thread in which Austin claims to have SWIPE_DOWN working in Flex.

 

So, following imports for Flex:

 

import qnx.events.QNXApplicationEvent;
import qnx.system.QNXApplication;

 

 

Added this to my existing oncreationComplete function

 

QNXApplication.qnxApplication.addEventListener(QNXApplicationEvent.SWIPE_DOWN,openAddMenu);

 

Then rather than go through all the Trace() headache, I did this:

 

private function openAddMenu(event:QNXApplicationEvent):void
{
	Alert.show("HELLO SWIPE!");
}

 

Ran it to the PlayBook sim, drug down - BOOM there's the alert.

 

 

So it is recognizing the SWIPE DOWN action, now to just get a menu to slide down.

 

Developer
LoganSix
Posts: 265
Registered: ‎01-02-2011
My Device: Z30, PlayBook

Re: Swipe Down Event

[ Edited ]

Here is what I did.

 

In my Init class I added the listener.  I also declared some default variables.

 

 

private var SLIDE_TIME:int = 1;
private var VISIBLE_Y:int = 100;

private function init():void {
// my screen start stuff
QNXApplication.qnxApplication.addEventListener(QNXApplicationEvent.SWIPE_DOWN, appMenuDisplay);

// get the menu height
menuGroup.y = -menuGroup.height;
}

 

Then I created the functions to handle the event and show and hide the menu.

 

 

 

private function appMenuDisplay(event:QNXApplicationEvent):void
{
if(menuGroup.y != VISIBLE_Y){
	showMenu();
} else {
	hideMenu();
}				
}
			
public function showMenu():void
{
Tweener.addTween(menuGroup, {y:VISIBLE_Y, time:SLIDE_TIME, transition:"linear"});
}

public function hideMenu():void { Tweener.addTween(menuGroup, {y:-menuGroup.y, time:SLIDE_TIME, transition:"linear"}); }

 

My menu group is a Spark VGroup, for those of you who don't want to do pure action script.

 

In other examples, people were trying to catch whether or not the mouse was swiped up or down from the top bezel.  With the SWIPE_DOWN call, it doesn't matter if the mouse goes up or down.  I tested this with the Browser on the simulator.  It doesn't matter if you swipe up or down from the top bezel, it just hides or closes the Browser based on if it was show or hidden before.

 

 

Edit....

Just realized after I posted this, that the VISIBLE_Y should be different than the height of the menu, but  basically, the menu height is needed to hide the menu.  So, the initial menu Y should be the negative of the height.  And the Hide should be the negative of the height.

 

// get the menu height 
menu.y = -menu.height;
_________________
Meetup for BlackBerry 10
Meetup Search Tool - not available at the moment