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
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha
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 :smileysad:

 

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

 

Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30

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

 

Please use plain text.
Developer
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

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

I have always the same issue... Event.COMPLETE is handled but the screen stays white :smileysad:

 

Nicolas

 

Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30

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.
Please use plain text.
Developer
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

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

 

Please use plain text.
Developer
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

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

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

 

Nicolas

 

Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30

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?
Please use plain text.
Developer
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

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

 

Please use plain text.
Developer
Paratheo
Posts: 134
Registered: ‎04-25-2009
My Device: Z30

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?

Please use plain text.
Developer
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

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

 

Please use plain text.