Thanks.

I decided on a different approach, unless something better comes along, I 
create a public application variable tempReports followed by 2 random digits. I 
use that to build a folder in the applicationStorageDirectory area. All reports 
get written there and I launch the default application with 
file.openWithDefaultApplication().

When the application is closed I delete the folder & contents.

When the application is launched I delete all tempReports(nn) folders. To clean 
up in case something got left behind.

I also added logic to add versions to the file names in the tempReports folder 
if the file already exists [myReport.pdf, myReport(1).pdf, myReport(2).pdf].

If you are wondering about the reason for the numbers at the end of the 
tempReports folder, it is my intention to allow multiple copies of the program 
to run simultaneously, which is how some users currently use the Flash 
applications.

Paul R. Stearns
Advanced Consulting Enterprises, Inc.

15280 NW 79th Ct.
Suite 250
Miami Lakes, Fl 33016

Voice: (305)623-0360 x107
Fax: (305)623-4588

----------------------------------------
From: "IDYLOG - Nicolas Granon" <ngra...@idylog.com>
Sent: 6/23/20 10:27 AM
To: <users@flex.apache.org>, <pa...@compuace.com>
Subject: RE: Create "web page" on the fly in AIR
Hi Paul,

For your information, we did run into the same exact problem when migrating our 
apps from FlashPlayer to AIR runtime (we generate reports in HTML or PDF format 
on the server and display them in a separate browser tab).

We have tried the 'inner' AIR browser solution but :
- it is quite complicated to setup, due to the security model (trusted domain 
vs untrusted domain) especially if your have dynamic data flowing to and from 
the remote http server (report parameters, error codes etc.). But it can be 
managed.
- but what we did discover (after having done the hard work, of course) is that 
CSS support of the embedded AIR browser is very poor (which was a real problem 
since we have a number of html reports and printouts) and not very consistent 
between MacOS and Windows. In the end, it was not a viable solution.
(also, we found performances to be so-so compared with recent browsers).

In the end, we have chosen the 'http/get' way (much simpler), with a simple 
(but effective) encrypting of the url parameters.
It is a bit ugly (but users don't seem to mind) and your are of course limited 
by the maximum length of url parameters (which is *not* so tiny, in fact, in 
modern browsers).
The server sends a session key in the early stages of the application and uses 
it for decoding url parameters.

Maybe there are other and smarter ways (sockets ?)...

Hope this helps!

Regards

Nicolas Granon

IDYLOG
Digital Engineering

13 Bd Princesse Charlotte
Monaco

ngra...@idylog.com
06.22.52.69.77

-----Message d'origine-----
De : Paul Stearns <pa...@compuace.com.INVALID>
Envoyé : mardi 23 juin 2020 15:12
À : users@flex.apache.org; users@flex.apache.org
Objet : Re: Create "web page" on the fly in AIR

Paulus:

I do not quite understand the approach outlined. I will restate what I 
currently do in Flash;

My Flash application, in many places, will create an HTTP/POST request which is 
sent to a web service. This web service takes the request and all of the POSTed 
arguments, runs a report generator and spits back a PDF "file" using the proper 
mime type. I do this from Flash using navigateToURL(urlRequest,"_blank") which 
causes the browser to pop up a new window/tab that receives the mime type PDF 
and launches the pdf viewer.

I need to convert this into AIR, but navigateToURL will convert POST requests 
to GET which the report generator ignores.

Paul R. Stearns
Advanced Consulting Enterprises, Inc.

15280 NW 79th Ct.
Suite 250
Miami Lakes, Fl 33016

Voice: (305)623-0360 x107
Fax: (305)623-4588

----------------------------------------
From: "Paulus de B." <w.p.stuur...@knollenstein.com>
Sent: 6/23/20 8:26 AM
To: users@flex.apache.org
Subject: Re: Create "web page" on the fly in AIR Hi Paul,

What if you create a local web server in AIR that when requested from the 
browser (HTTP GET) performs a HTTP POST from your application to your server 
and streams the response back to the browser? Doesn't that solve the problem?

Cheers

Paulus

--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/


Reply via email to