08-18-2012 05:47 AM
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.test
It seems that now, I can't open my file ![]()
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
Solved! Go to Solution.
08-18-2012 06:07 PM - edited 08-18-2012 06:10 PM
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
08-21-2012 01:26 PM
I have always the same issue... Event.COMPLETE is handled but the screen stays white ![]()
Nicolas
08-21-2012 01:31 PM
08-21-2012 01:40 PM
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
08-21-2012 03:14 PM
It seems that QNXStageWebView doesn't like change setSize...
Nicolas
08-21-2012 03:25 PM
08-21-2012 04:02 PM
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
08-22-2012 01:54 PM
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?
08-22-2012 05:24 PM
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