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
Posts: 323
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900
My Carrier: Telus

Can't get a WebView working on BB10 @ 100% Zoom Level

I have QNXStageWebView's working in several AIR apps at 100% (e.g. rendering at 1:1 pixel ratio) on my PlayBook but running similar code on my BB10 Dev Alpha device always zooms in (approx 3x) when loading.

 

The WebView's I have are used to display non-scrollable, non-zoomable content and have (as mentioned before) worked flawlessly in the past but just don't seem to behave on BB10 at all.

 

Here's the code I'm using at the moment (although I've tried dozens of minor variations to this trying to get it to work).

 

In AS3:

 

var appPath:File = File.applicationDirectory.resolvePath('SomeFile.html');
var filePath:File = new File(appPath.nativePath);

var rect:Rectangle = new Rectangle(0, 0, 720, 1280);//yes I've tried 720 & 768
webView = new QNXStageWebView("myWebView");
webView.viewPort = rect;
webView.enableCookies = true;
webView.enableJavaScript = true;
webView.addEventListener(JavaScriptCallbackEvent.JAVA_SCRIPT_CALLBACK,javaScriptCallbackHandler);
webView.stage = this.stage;
webView.visible = true;
webView.zoomToFitWidthOnLoad = false;
webView.zOrder = -1;
webView.loadURL(filePath.url);

 

 

and in my "SomeFile.html" file is basically this:

 

<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi"/>
<style type="text/css">
*{margin:0;padding:0;}
body{
background-color:#000;
color:#fff;
height:1280px;
width:720px;
overflow:hidden;
}
#gameboard{
height:1280px;
width:720px;
overflow:hidden;
}
</style>
</head>
<body id="body" bgcolor="#000000" text="#000000">
<div id="fixedContainer">
<div id="gameboard"></div>
</div>
</body>
</html>

 

(not shown, the gameboard is populated with content via JavaScript that never exceeds the device dimensions)

I've tried hard coding the device-width, adding/removing the device density DPI setting, etc. etc.

 

Has anyone had any luck with this so far on BB10?


PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****
Highlighted
Developer
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Can't get a WebView working on BB10 @ 100% Zoom Level

[ Edited ]

Is this pure AS3 or Flex MXML?

 

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Developer
Posts: 323
Registered: ‎05-07-2009
My Device: BlackBerry Z10, PlayBook, 9900
My Carrier: Telus

Re: Can't get a WebView working on BB10 @ 100% Zoom Level

It's pure AS3... And yeah I noticed the new zoomToFitWidthOnLoad property and have tried setting it to both true and false with no luck.

PlayBook Apps: DataMine, Dots + Boxes, 5 Marbles
BlackBerry SmartPhone Apps: 5 Marbles Soon: **** (D.Z.A), ****Quest, **** Challenge, VaultCracker, DevBrowser, Radial****