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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR
Accepted Solution

QNXStageWebView: New issue since the PlayBook OS update !

Hi,

 

In my Air application, I use QNXStageWebView to do a help section. So I'm used to embbed my help pages in my bar file ; so as to open with QNXStageWebView component.

 

It works well before the last PlayBook OS update. I store my HTML pages in :

 

file:///accounts/1000/appdata/PlayCloud.debug.testDev_Cloud_debugXXXXXXX/app/air/help/index-en.html

 

It seems that now, I can't open my file Smiley Sad

 

Which is OS changement ? How can I process now ? Can I continue to use HTML pages ? Have I to convert my HTML pages in Air ?

 

Nicolas

 

Developer
Posts: 142
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: QNXStageWebView: New issue since the PlayBook OS update !

[ Edited ]

If the issue seems to be that the page never loads and you only get a white screen, I have the exact same issue except my StageWebView loads a login page for my app, which is quite problematic when it doesnt work.

 

Either way, I have found that the first time you try to load the page it never works, so as a workaround do the following.

Initially point the StageWebView to a random URL, www.google.com is what I used and works well. Then you must set up an event listener on the WebView for the Event.COMPLETE event. When this event occurs, change the source or url property of the StageWebView to the path for your help file, and remove the event listener you set up previously. This setup *should seamlessly display only your file and not the google page.

 

Lemme know if you got any questions

 

Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: QNXStageWebView: New issue since the PlayBook OS update !

I have always the same issue... Event.COMPLETE is handled but the screen stays white Smiley Sad

 

Nicolas

 

Developer
Posts: 142
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: QNXStageWebView: New issue since the PlayBook OS update !

Hmm, and you are making sure to change the url to the path of your help file when the event is handled, right?
Once I get home I will look at my own project and suggest something else, but my solution above really should have done the trick.
Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: QNXStageWebView: New issue since the PlayBook OS update !

So, I have just success to get the image !

 

In fact, I don't need to use your workaround. My issue is linked in my draw override function.

 

I have to now understand why with this new release, my code doesn't work !

 

Nicolas

 

Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: QNXStageWebView: New issue since the PlayBook OS update !

It seems that QNXStageWebView doesn't like change setSize...

 

Nicolas

 

Developer
Posts: 142
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: QNXStageWebView: New issue since the PlayBook OS update !

I'm glad u figured it out. Now could you please explain what the issue was and how you fixed it?
Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: QNXStageWebView: New issue since the PlayBook OS update !

Hi,

 

I think that in my first release, my viewPort isn't correct and I can draw my QNXWebView outside of my container.

 

Here, my class :

 

package 
{
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.events.Event;
	import flash.filesystem.File;
	import flash.geom.Rectangle;
	
	import qnx.media.QNXStageWebView;
	
	
	public class HelpView extends Container
	{
		private var webview:QNXStageWebView;
		
		private var _filePath:File;
		
		
		public function HelpView(rect:Stage, locale:String='en')
		{
			super();
			super.setSize(rect.stageWidth, rect.stageHeight);
			
			trace("[HelpView]", "width = " + rect.stageWidth + " height = " + rect.stageHeight);

			webview = new QNXStageWebView("LocalVP");
			webview.stage = rect;
			webview.viewPort = new Rectangle(0,0,rect.stageWidth,rect.stageHeight);
			webview.visible = true;
			webview.blockPopups = true;
			webview.enableJavaScript = true;
			webview.enableLocalAccessToAllCookies = true;
			webview.zOrder = 1000;
			
			var appPath:File = File.applicationDirectory.resolvePath('help/index-' + locale + '.html');
			_filePath = new File(appPath.nativePath);
			
			webview.loadURL(_filePath.url);

			if (!webview.hasEventListener(Event.COMPLETE))
				webview.addEventListener(Event.COMPLETE, onDownloadComplete);
		}
		
		
		public function setLocale(locale:String):void {
			var appPath:File = File.applicationDirectory.resolvePath('help/index-' + locale + '.html');
			_filePath = new File(appPath.nativePath);
		
			webview.loadURL(_filePath.url);

			if (!webview.hasEventListener(Event.COMPLETE))
				webview.addEventListener(Event.COMPLETE, onDownloadComplete);
		}
		
		
		public function onDownloadComplete(event:Event):void {
			trace('[HelpView]', 'onDownloadComplete:');
			
			webview.removeEventListener(Event.COMPLETE, onDownloadComplete);
		}
		
		
		public override function setSize(width:Number, height:Number):void
		{
			trace("[HelpView]", "setSize: widthxheight = ", width, 'x', height);
			
			super.setSize(width, height);

			if ((width > 0) && (height > 0)) {
				webview.viewPort = new Rectangle(0,0,width,height);
			}
		}
		
		
		public override function destroy():void
		{
			webview.visible = false;
			webview.stage = null;
			webview.dispose();
			webview = null;
			
			super.destroy();
		}
	}
}

 Nicolas

 

Developer
Posts: 142
Registered: ‎04-25-2009
My Device: Z30
My Carrier: AT&T

Re: QNXStageWebView: New issue since the PlayBook OS update !

Sorry but I still do not understand what the issue was.  Could you please provide some more detail so others with this problem, including myself, can fix it?

Developer
Posts: 154
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
My Carrier: SFR

Re: QNXStageWebView: New issue since the PlayBook OS update !

Before the PlayBook OS update, I set a default viewport size for my webview. Then I resize it in override the function draw.

 

It worked and now not.

 

So I have changed my code to define the viewport in the constructor or in using the function setSize and not in the draw function.

 

I haven't more issue. 

 

Nicolas