01-26-2011 10:04 AM
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?
01-26-2011 10:15 AM
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)
01-26-2011 10:21 AM
01-26-2011 10:26 AM
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?
01-26-2011 11:05 AM
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.)
01-26-2011 11:17 AM
01-26-2011 01:26 PM
Okay, so am I even doing the trace right?
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:
public function AppMenuDemo()
trace("Swipe down event fired");
// show the menu bar on SWIPE_DOWN
private function showAppMenu(event:QNXApplicationEvent):void
trace("Swipe down event fired");
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?
01-26-2011 01:27 PM
01-26-2011 01:29 PM - edited 01-26-2011 01:29 PM
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
01-26-2011 01:29 PM
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.