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
Highlighted
Developer
Posts: 153
Registered: ‎10-26-2010
My Device: Bold 9900
My Carrier: AT&T
Accepted Solution

Reading HTML files from the .bar file

[ Edited ]

Hi,

 

I'd like to include user documentation in .html format (embedded next to my icons and pictures in the .bar file) with my app and use QNXStageWebView to display it.  My filename is "docs.html"  What do I need to pass into the webView.loadURL(); command to get at my file?

 

 

Oh, and how do I dispose of the viewer when the customer is done with it and clicks my "Return" button?

 

Harry

--------------
Accepted PlayBook Applications: Marmi-doos, BASIC, Run and Hide, SuperClip
Accepted OS4-7 SmartPhone App: KeepLightOn
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Reading HTML files from the .bar file

hey harry,

 

i tried using a ton of notations but nothing seems to work. event tried to hard code it in to the .as file and still no go. when you load up the .html into the bar file its copied into the same folder as the application but the QNXStageWebView cant seem to open it up.

 

here's what i tried, maybe someone else has other options:

 

web address set to: "app:/index.html" or "app://index.html" or "index.html"

 

tried using the URL Request object but no go. Even tried using the file object no go.

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Reading HTML files from the .bar file

Stupid question.  Are you certain the file is even on the simulator?  Have you checked by using:

 

File.exists?

 

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Reading HTML files from the .bar file

@jtegen: yeah i checked via the exist function and it exists when you check via the .as file. anything you put under the src directory is automatically packaged into the .bar file. at least it is under flash builder.

 

@harry: figured it out! ok so my final assumption is that when you load the QNXStageWebView up it looks for for files in an absolute path manner. meaning you cant just use "file.html" you hafta use the absolute path. so heres the code that should let you view your HTML file:

 

 

webView.loadURL(File.applicationDirectory.nativePath + "/docs.html");

 

 

and as for disposing try using this:

 

 

webView.destroyBrowser();

 

good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Regular Contributor
Posts: 66
Registered: ‎11-13-2010
My Device: Not Specified

Re: Reading HTML files from the .bar file

If you watch the Rogers tablife video, there seems to be 2 different browsers on the Playbook --- one is made by QNX and the second browser is made by the Torch Mobile team.  The Torch browser is the full feature browser and the QNX browser is the light weight embedded browser.

New Contributor
Posts: 7
Registered: ‎02-18-2011
My Device: Not Specified

Re: Reading HTML files from the .bar file

I had a similar issue. The solution provided by JRab didnt worked for me. What did worked is:

 

 

loadURL("file://"+File.applicationDirectory+"/filename.html");

 

Hope this helps.

 

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Reading HTML files from the .bar file

An earlier post I made on the topic seems relevant.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Developer
Posts: 120
Registered: ‎11-24-2010
My Device: 9700

Re: Reading HTML files from the .bar file

It seems like no two people have been able to get this to work the same way, if at all.  Which sucks because the last thing my app needed was to get this working to display a help file.  I don't know, maybe the viewer got broken in the 9.4 simulator/library.  Oh well, no free tablet for me.  At least I got signed up as a vendor for free.