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
Posts: 31
Registered: ‎10-22-2011
My Device: Playbook
My Carrier: no carrier

QNXApplicationEvent.SWIPE_DOWN

I have the following code :


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


When i deploy the app on the playbook and start it i get a white screen only. if i remove this line everything is fine.



_______________________________________________________
Check my apps for Playbook at AppWorld:
Flash Video Player
Playbook Gallery for Facebook
Playbook Stream Player
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: QNXApplicationEvent.SWIPE_DOWN

When are you calling this and what does the appMenuDisplay function look like?
Contributor
Posts: 31
Registered: ‎10-22-2011
My Device: Playbook
My Carrier: no carrier

Re: QNXApplicationEvent.SWIPE_DOWN


 

<?xml version="1.0" encoding="utf-8"?>

<s:View

xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="

library://ns.adobe.com/flex/spark"

xmlns:adm="

http://www.adm.org"

xmlns:mx="

library://ns.adobe.com/flex/mx"

actionBarVisible="

false" title="Sample App" viewActivate="initView(event)">

 

<fx:smileyfrustrated:cript>

<![CDATA[

import org.osmf.events.MediaPlayerStateChangeEvent;

import org.osmf.events.TimeEvent;

import flash.display.Sprite;

import flash.events.MouseEvent;

import flash.display.StageDisplayState;

import qnx.system.QNXApplication;

import qnx.events.QNXApplicationEvent;

import caurina.transitions.Tweener;

import spark.events.ViewNavigatorEvent;

privatevar SLIDE_TIME:int = 1;

privatevar VISIBLE_Y:int = 58;

privatefunction initView(e:ViewNavigatorEvent):void{

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

// get the menu height

menuGroup.y = -menuGroup.height;

}

 



privatefunction appMenuDisplay(event:QNXApplicationEvent):void

{

if(menuGroup.y != VISIBLE_Y){

showMenu();

}

else {

hideMenu();

}

}

publicfunction showMenu():void

{

Tweener.addTween(menuGroup, {y:VISIBLE_Y, time:smileyfrustrated:LIDE_TIME, transition:

"linear"});

}

publicfunction hideMenu():void

{

Tweener.addTween(menuGroup, {y:-menuGroup.y, time:smileyfrustrated:LIDE_TIME, transition:

"linear"});

}


this is the code.

_______________________________________________________
Check my apps for Playbook at AppWorld:
Flash Video Player
Playbook Gallery for Facebook
Playbook Stream Player
Developer
Posts: 75
Registered: ‎09-13-2011
My Device: Playbook
My Carrier: None

Re: QNXApplicationEvent.SWIPE_DOWN

[ Edited ]

What happens if you just comment out the tweener calls? I suspect there might be a problem with the tweeners. I personally prefer using Spark animations to slide the menu.

 

<fx:Declarations>
	<!-- Place non-visual elements (e.g., services, value objects) here -->
	<s:Animate id="slide_toolBar" duration="600" target="{tool_bar_grp}">
		<s:SimpleMotionPath property="y" valueFrom="-80" valueTo="0"/>
		<s:SimpleMotionPath property="x" valueFrom="0" valueTo="0"/>
	</s:Animate>
</fx:Declarations>

<fx:Script>

import qnx.events.QNXApplicationEvent;
import qnx.system.QNXApplication;
import spark.effects.easing.Elastic;

private function init():void
{
	QNXApplication.qnxApplication.addEventListener(QNXApplicationEvent.SWIPE_DOWN, slide_tool_bar);
}
private function slide_tool_bar(e:QNXApplicationEvent):void
{
	setElementIndex(tool_bar_grp, numElements -1);
	var elastic:Elastic = new Elastic();
	elastic.ease(0.0);
	slide_toolBar.easer = elastic;
	if (tool_bar_grp.y == 0){
		hide_toolBar.play();
		tool_bar_grp.visible = false;
	}
	else{
		tool_bar_grp.visible = true;
		slide_toolBar.play();
	}
}
private function hide_tool_bar():void
{	
	if (tool_bar_grp.y == 0){
		hide_toolBar.play();
		tool_bar_grp.visible = false;
	}
}
</fx:Script>

 

 



Show your support and click on the like button when you see a post that was helpful.
Contributor
Posts: 31
Registered: ‎10-22-2011
My Device: Playbook
My Carrier: no carrier

Re: QNXApplicationEvent.SWIPE_DOWN

[ Edited ]

oddly but now everything works as expected. I did not change the code. just uncomented the QNXApplicationEvent.SWIPE_DOWN line and recompiled.

very strange.

 

edit:

i changed

creationComplete="init();"

and then put :

private

function init():void

{

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

}

 

and it works

_______________________________________________________
Check my apps for Playbook at AppWorld:
Flash Video Player
Playbook Gallery for Facebook
Playbook Stream Player
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: QNXApplicationEvent.SWIPE_DOWN

So the other way probably did not have the qnxAppliction initialized yet.
Contributor
Posts: 31
Registered: ‎10-22-2011
My Device: Playbook
My Carrier: no carrier

Re: QNXApplicationEvent.SWIPE_DOWN

Just for the sake of the discussion:
Probably, but then why the white only screen ? If it's not initialized then it will not get invoked but will not block the whole application.
Anyway, the problem is fixed now :-)
_______________________________________________________
Check my apps for Playbook at AppWorld:
Flash Video Player
Playbook Gallery for Facebook
Playbook Stream Player