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

Swipe Down Event

I don't know what I'm doing wrong.  I followed the example from the DevBlog. I customized it a bit for my own purpose, sent it to the simulator to watch the magic, swiped down and nothing happened. So I rechecked code, went back through the example and verified everything.  Still couldn't get it to work.

 

So I just downloaded the source files, and imported them into the project, launched, and again nothing happened. I'm using the latest simulator, SDK, etc..

 

I tried putting it in it's own directory, in the same as main package, etc.. nothing works. Right now I'm just trying to use the default AppMenuDemo.as and MenuBar.as files.  So in Flash Builder I've got the import information to where they're located:

 

import com.Navigation.AppMenuDemo;
import com.Navigation.MenuBar;

Am I forgetting to import something else?  I've tried importting QNX events and application and touch events and nothing seems to make a difference.

 

Am I that far off base?  Don't I just import these in the code, the .as files are in the package list in the corresponding location.  It should just work, right?  What am I doing wrong? smiley-headwall.gif

Developer
Posts: 229
Registered: ‎08-14-2009
My Device: Bold 9900, DevAlpha A
My Carrier: Vodafone DE

Re: Swipe Down Event

This might be to obious but just to be sure. From where exactly are you swiping down? You need to start swiping from outside of the visible PlayBook screen. (virtual bezel)

Willy R.
-
If my post solved your problem, make it easier for others to find by Accepting it as a solution or provide a Kudo if it was helpful for you. Thanks.
Developer
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: Swipe Down Event

Lol yeah, forgot to mention that I've tried all the swiping locations along the top bar. I can make the system tray come down but not the menu. System tray comes down top left or right corner.
Developer
Posts: 229
Registered: ‎08-14-2009
My Device: Bold 9900, DevAlpha A
My Carrier: Vodafone DE

Re: Swipe Down Event

Have you tried using the exact same code as from the example without any modifications? Did this work? Have you tried putting a trace for the SWIPE_DOWN event to see if it's even fired?

Willy R.
-
If my post solved your problem, make it easier for others to find by Accepting it as a solution or provide a Kudo if it was helpful for you. Thanks.
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Swipe Down Event

Putting a trace() call at the start of the event handler is a great first step.  If it works, any failure to show a menu is related to your own code.

 

By the way, with the first simulator you could not listen for both SWIPE_START and SWIPE_DOWN.  That limitation may have persisted into the Beta 2 simulator; I haven't re-tested or heard from anyone who has.  If you're listening for both, remove the one and verify that the other works by itself.

 

Also, note that SWIPE_START is sent any time you even touch along the top bezel.  SWIPE_DOWN is sent only when you start at the top and drag your finger down past a certain threshold (Y value).  That's how it tries to ensure the gesture was intentional.  Maybe you're just not swiping far enough?  (Very unlikely, I know.)


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

Re: Swipe Down Event

Swiping from top middle straight down.  I had to run and get a sick kid from school, but back now and will add a trace in.

 

Not using any other code to listen for swipe.

Developer
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: Swipe Down Event

Okay, so am I even doing the trace right?

 

I added:

 

import flash.trace.Trace;

 

 

To the main app.  Then in the AS for AppMenuDemo I included the trace.  First in one place, then in the other, then in both.  The only SWIPE_DOWN references I could find were in the AppMenuDemo.as:

 

 

// constructor
public function AppMenuDemo()
trace("Swipe down event fired");
{
initializeUI();
QNXApplication.qnxApplication.addEventListener(QNXApplicationEvent.SWIPE_DOWN, showAppMenu);
}

 

and

 

 

// show the menu bar on SWIPE_DOWN
private function showAppMenu(event:QNXApplicationEvent):void
trace("Swipe down event fired");
{
if(! _menu.isVisible())
{
_menu.show();
}
}

 

 

Now, when I try to run the app in debugger mode to the PlayBook sim, it fails saying it's not a valid .bar.  When I run normal, it doesn't pass anything to the console.  I can't run it to the Adobe AIR Desktop, no top swipe there.

 

What's the easiest way to debug this?

 

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

Re: Swipe Down Event

Add the trace inside the function.

 

private function showAppMenu(event:QNXApplicationEvent):void
{

  trace("Swipe down event fired");

  if(! _menu.isVisible())
  {
    _menu.show();
  }
}

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

Re: Swipe Down Event

[ Edited ]

hey john,

 

a few notes you dont need to import the trace class. its always available by default. and also place the trace() statements within your function braces. that's probably what is causing the new errors. hope that clears up some. good luck!

 

Edit: ahh. well played. jtegen beat me to it haha

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: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Swipe Down Event

1. You don't need to import anything.  The trace() function is globally available.  The flash.trace.Trace module is an undocumented and different beast that you don't need here.

 

2. The trace() call is just a regular function call, so it has to be inside your code.  You've put it outside the code and that probably explains the "not a valid .bar file" thing.

 

3. The calls to trace() are quietly removed when you are running in normal mode, so they won't output anything and won't affect performance.  You have to use debug mode to get this to work.

 

If it's not working, make sure you have actually built a new .bar file correctly and that you're running the right app.  On my machine (not using the IDE though), I get separate icons for the normal-mode and the debug-mode apps.


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!