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
New Developer
OMA2k
Posts: 17
Registered: ‎02-26-2012
My Device: Blackberry Playbook
My Carrier: Yoigo

I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

[ Edited ]

Hello all. I've just received the free Blackberry Playbook tablet from the promotion they did about submitting new apps to the App World. The tablet, its OS and even the packaging it comes in is really nice :Balloon:

 

One of the first things I've tried to do with it is download my own app from the App World to see how it looks like in this device. But disappointingly, I've found out that it doesn't work properly because one of the main parts of the app, which is a list shown through a StageWebView, just doesn't appear in the screen. The app works "fine" otherwise, but that HTML list is one of the main parts of the app, and without it, you can't really use the app (you can't go further until you select something from that HTML list).

 

What puzzles me is how could Blackberry approve my app into the App World if it doesn't actually work. But what puzzles me even more is, there is a user comment in my app that talks about how the app could be improved, but never says anything about the app not working! So I assume the StageWebView is somehow working for that user.

 

To be frank, that problem of the StageWebView component not showing was already happening when testing the app in the Playbook emulator image for VMWare. But since after trying all sorts of stuff I couldn't figure out how to fix it, I thought it was maybe just a problem with the emulator itself (this AIR app is also published in Apple's App Store and in Android's Google Play and both versions work perfectly; there are also Windows and MacOS X versions which also work).

 

So, since I thought it was a problem of the emulator and I didn't have a physical Playbook tablet to test it on, I submitted the app for approval anyway, figuring that if the app didn't work in a real Playbook tablet, then Blackberry would reject the app and at least I could be sure the emulator wasn't the culprit. But since Blackberry actually approved the app, I thought it would work fine, until now when I've received the Playbook.

 

The only explanation I can think about the app working for the user who left the comment is that maybe the StageWebView problem only happens in Tablet OS 2.0. I updated the Tablet OS to the latest version since I was prompted to do so soon after powering on the Playbook tablet for the first time, so I couldn't test my app with an earlier version of the OS.

 

Since my app is compiled with AIR 3.1, I configured the app in App World as requiring a minimum version of 1.0.8 of Tablet OS, which is, as far as I know, the first version to support AIR 3.1. Maybe that user has Tablet OS 1.0.8 and that's why it worked for him? Maybe the Blackberry App World approval team used Tablet OS 1.0.8 for their tests? Who knows?

 

Anyway, does anybody have any idea as to why my StageWebView is invisible? The odd thing is, even though you can't see it, it seems it's actually working, because the AS3 part of the app reads part of the HTML page to get some data for a sidebar done in AS3, and that data is actually appearing in the sidebar! So the app is receiving the HTML page data loaded by the StageWebView. It's just that it doesn't appear in the screen. I've checked several times the viewport and other details and everything seems to be correct (plus that very same StageWebView code is working fine in iOS and Android!).

 

To add some extra info, I'm actually using a wrapper class called StageWebViewBridge that extends StageWebView (you can Google that to check out that cool library :Yes:), but I don't think that makes any difference, because I'm also using the regular StageWebView class (no wrapper) for a contact form inside the app, and that form is also invisible!

 

I hope somebody can help me :Helpsmilie:

 

Thanks for reading!

 

Best regards,

OMA2k

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

Have you tried doing a cold boot (vol+, vol-, power, hold for 10 secs) of your device?

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
Please use plain text.
New Developer
OMA2k
Posts: 17
Registered: ‎02-26-2012
My Device: Blackberry Playbook
My Carrier: Yoigo

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

Thanks for your message. I've tried what you suggested but the problem persists. I'm afraid this is not just happening to me, but still, it's not happening to everyone, either, since I got a comment from someone who apparently didn't have any technical problem with the app.

 

Any further ideas?

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

Are you loading a file via http:, a local file or setting the content manually?

 

The reviewer may be using an old OS version. I don't think there is an easy way to downgrade, even for developers.

 

You could test whether cpu/gpu makes a difference...

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
Please use plain text.
New Developer
OMA2k
Posts: 17
Registered: ‎02-26-2012
My Device: Blackberry Playbook
My Carrier: Yoigo

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

All pages are remote pages (http requests). I'm using CPU mode because I'm using some Flash effects which don't work in GPU mode.

 

So is this a known issue for Tablet OS 2.0?

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

It's not a know issue AFAIK. I've used StageWebView in various apps without problems. Perhaps you could try to reproduce the problem in isolation (e.g. a minimal test app) and maybe post a code snippet for us to look over...

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
Please use plain text.
New Developer
OMA2k
Posts: 17
Registered: ‎02-26-2012
My Device: Blackberry Playbook
My Carrier: Yoigo

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

Well, I've made a little test application that only shows a website in a StageWebView, and that works in the Playbook, so I have absolutely no idea what's different in my actual app to make the SWB invisible (I've even copy&pasted the code from my app!).

Please use plain text.
New Developer
OMA2k
Posts: 17
Registered: ‎02-26-2012
My Device: Blackberry Playbook
My Carrier: Yoigo

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

[ Edited ]

I think I've found where's the problem.

 

The StageWebView is not shown if the AIR application doesn't have the Playbook resolution and therefore has to be scaled.

 

My app was designed with Android Honeycomb's usual resolution in mind: 1280x800 minus 48 pixels for the always visible bottom toolbar, so its resolution is 1280x752

 

When running in other Android devices with lower resolution, the whole app just scales down (The stage.scalemode is set to StageScaleMode.SHOW_ALL so it's proportionately scaled), and the StageWebView viewports are also automatically scaled accordingly in Android devices.

 

But in the Playbook, all StageWebView viewports just disappear instead of properly scaling!

In my small test app I mentioned in my last post the StageWebView was visible at first because my test app had a 1024x600 resolution (Playbook's native resolution, as you know), but after I changed it to 1280x752 (the same I'm using in my actual app), the StageWebView wasn't visible anymore.

 

Please, fix this. StageWebViews should work properly in scaled applications, not just disappear without notice!

 

For now, the workaround is manually calculating the resolution of the StageWebView and manually set the proper dimensions. If the whole viewport is inside the 1024x600 screen, then the StageWebView will be shown. If just a part of the viewport falls outside the screen, the whole viewport will be invisible for no reason. In Android that doesn't happen: The viewport is actually scaled. Even if the viewport is bigger than the actual device resolution, it will be scaled like any other display object of the scaled application.

 

But in Blackberry TabletOS 2.0 it seems it doesn't scale the StageWebView at all and uses absolute device pixel coordinates (not dependent in the app's scale factor) to place the viewport, instead of actually scaling it. And the worse part is it just makes the viewport disappear if it's just a bit bigger than the screen.

 

Apparently, this didn't happen in older versions of Tablet OS (1.0.8 and older), because both the Blackberry App World approval team and the user who left a comment in my app had no problem with my app, so the StageWebView must have worked for them.

 

Will this be fixed? I'll use the workaround I've mentioned for now, but I'm afraid if this gets fixed in a new revision of the OS, then the StageWebView wouldn't be properly shown again, as it it would be smaller than needed, it would overlap other UI elements and look bad. Well, at least my app would be still usable anyway.

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

StageWebView is not part of the flash display stack, but is layered on top of the stage in front of all Flash objects. Therefor, it doesn't take part in any scaling or other transformation. I think that's by design. Have you found it to work differently on other platforms?

 

You could also try the PlayBook-specific QNXStageWebView component to see whether it works better for you, but if you are using a single codebase for multiple platforms it will need some creative coding otherwise it could break your code on other platforms.

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
Please use plain text.
New Developer
OMA2k
Posts: 17
Registered: ‎02-26-2012
My Device: Blackberry Playbook
My Carrier: Yoigo

Re: I have an (apparently) non-working application in the App World because of StageWebView (it's not visible at all)

[ Edited ]

Innovatology wrote:

StageWebView is not part of the flash display stack, but is layered on top of the stage in front of all Flash objects. Therefor, it doesn't take part in any scaling or other transformation. I think that's by design. Have you found it to work differently on other platforms?


Yes, in Android the StageWebView viewport is actually resized and repositioned along with the rest of Flash Display Objects, to match the movie, no matter how it's resized in the device screen (remember this resizing is not made from my AS3 code, but it's an automatic thing AIR does when the main stage size is different than the device resolution; maybe AIR for Playbook behaves different for SWVs).

 

I know that an StageWebView is not an actual Display Object (that's why it uses a "viewport" and you assign a stage, rather than just setting its position and size and then using addChild). So I was a little surprised that I didn't have to do any extra calculations in Android because it was automatically resized and repositioned, but that was fine by me :smileyhappy:

 

In the Playbook, however, it seems it's not automatic. But the worst part (and this must be a bug) the viewport disappears as soon as it's even just 1 pixel wider than the screen allows! (a 1025x600 StageWebView will be completely invisible, just for being 1 column wider than the screen, instead of just showing the StageWebView except for the last column of pixels). The same happens if the size is within the resolution limits but it's moved just one pixel outside the screen. It disappears! This should be fixed, I think.

 

BTW, there's a new surprise. I just realized my Playbook emulator (which I used when testing the app before submitting), has version 1.0.8.6067 of the Tablet OS (I thought it was 2.0 but now I remember that the 2.0 emulator wasn't actually out yet when I downloaded the Playbook emulator image), and it reproduces this bug!

 

So now I can reproduce the bug both with Tablet OS 1.0.8.6067 in the VMWare emulator image, and with Tablet OS 2.0.0.7971 in a real Playbook tablet. So which version of Tablet OS is the one that doesn't reproduce this bug? (since this bug apparently doesn't happen with some versions of the OS).

 

Is there a "bugbase" page where I can submit this bug?

 

Well, I'm leaving here the workaround code I've used to fix my app, in case someone stumbles into this problem:

 

if (Capabilities.version.substr(0, 3) == 'QNX')
{
      var coefX:Number = Capabilities.screenResolutionX / myAppResolutionX;
      var coefY:Number = Capabilities.screenResolutionY / myAppResolutionY;
      viewport_x *= coefX;
      viewport_y *= coefY;
      viewport_width *= coefX;
      viewport_height *= coefY;
}

Assuming viewport_x, viewport_y, viewport_width and viewport_height are variables with the regular viewport used in other platforms such as Android or iOS (make sure they're defined right before this code, to avoid applying the coef twice), and myAppResolutionX/myAppResolutionY represents the actual Flash/AIR app dimensions (in my case 1280x752)

Please use plain text.