Adobe AIR doesn't save file with file's extension - actionscript-3

I am working on Adobe AIR application and some test users report to me about same issue. When they try to save the project file from this application, they have no possibility to add any extension (".txt", ".xml" or any other) to the file. All these users use Microsoft Windows.
What can be the cause of the problem?

It looks like this is a pretty standard issue with the browseForSave method of saving files. This post should give you a workable solution for ensuring the correct filetype is entered: http://analogd.com/blog/adobe-air/adobe-air-tips-serie-browseforsave-set-default-file-extension-and-validatemodify/

Related

What is the correct way to display a HTML file downloaded and saved in the file system using codename one?

What is the correct way to display a HTML file downloaded and saved in the file system? I am able to download and save the html page in the .cn1 folder on Simulator but it doesn't display. I tested using the Page.html sample file found in the old Kitchen Sink demo.
Also, how can I use hardcoded paths like file:///storage/emulated/0/Folder/Page.html instead? I have tried but nothing appears in common folders in the phone e.g. the Android folder. Below is what I have done so far!
`Form fm_brw = new Form();`
`fm_brw.setLayout(new BorderLayout());`
`FileSystemStorage fs = FileSystemStorage.getInstance();`
`fs.mkdir(fs.getAppHomePath() + "SampleFolder");`
`Util.downloadUrlToFile("http://somesite.com/Page.html", fs.getAppHomePath() + "SampleFolder/Page.html", true);`
`BrowserComponent browser = new BrowserComponent();`
`browser.setURL(fs.getAppHomePath() + "SampleFolder/Page.html);`
`fm_brw.addComponent(BorderLayout.CENTER, browser);`
`fm_brw.show();`
You can't hardcode paths on phones as those differ even on the same phone for new installs to keep app isolation.
Your approach is correct but I'm assuming the html refers to images and other resources which are now unavailable so the process of downloading an HTML file for offline viewing is more complex as you would need to download all the resources then edit the HTML source to reference local files instead of server files.
#Shai Almog - Happy 2018 and please accept my apologies for the delayed reply. I figured out the reason for the webpage not diplaying... apparently, you have to add the "file://" when setting the url i.e. browser.setURL("file://"+str_homePath+str_filePath);
If this is not by your design then I can file an RFE.

Updating AIR application with embedded runtime?

I'm writing a AIR application with an embedded runtime (.app) and am having trouble finding a way to update it. I need to somehow download a new .app off a server and overwrite the existing file, and promptly restart the application. I'm clueless on how I'd achieve this.
Any ideas?
Try this: https://code.google.com/p/nativeapplicationupdater/
Or, if you only need to update some content that is used by the app, you can just have your app download it using URLLoader and store it using File, say to File.applicationStorageDirectory.

Flash swf publishing

I have a problem here regarding flash+as3.
I'm makin an application that take data from XML file and show it on flash.
Now here's my problem.
When I preview the file, it went just fine. All the data been shown on the flash.
When I published it into .exe file, it also went just fine. All data been shown.
But...
When I published it into .swf file, there's a problem. All the graphical images been show, but data that i got from the XML file does not shown.
But when I took the published file and drag it into flash, it went just fine. All the data been shown.
I'm not quite sure what happen. Is there any setup that I have to do to solve this problem?
Thanks guys.
2 possible problems:
your path to the xml data is relative and your published swf can't find it.
More likely your xml data is on a web server and you are looking at the swf through a local webpage using file:///myfile.html. This fails because of security. Adobe have decided that local swfs can only look at local content, and network swfs can only look at network content. This rule is disregarded in the flash ide because if you have the flash ide you are a developer and you should know what you are doing.
Check out your swf on a web server and report back.

compiling HTML5 to .exe/.dmg

I am currently beginning a project where we want to build an Interactive Whiteboard (educational activities) and deploy via CD-ROM. I want to build the project in HTML5 for it's interactivity and then somehow compile it to both .exe. and .dmg so when the CD-ROM is inserted it autoplays the 'Game'.
How is this possible? Any help/advice would be greatly appreciated. Thank you.
I already made a project using pure C (WinAPI) on github that can pack HTML files into single EXE using resources.
http://github.com/dns/WinAPI-Embed-Browser/releases
Use: res://programname.exe/test.html as path to access html files from your EXE file.
From here you also can hide the window border & just showing the content of your HTML app, or even running on fullscreen. This is very useful if you want to make interactive CD-ROM.
On Mac, you can use Delphi/Lazarus TWebBrowser control to load html files. However I don't know if mac program can access files from resource or not.
HTML 5 is a browser technology, so I think as long as the pc you are installing on has the latest browsers, installing your app should work fine.
Can you tell us why you want it as a CD-ROM based installation, where as you can easily host it online?
You may not need any .exe wrapping. Here is an approach.
Important: your autorun will be often disabled, [not so] quietly. Provide some instructions for running your application manually.
So:
Google for running a portable version of Firefox or Chrome from a CD. Have the browser prepared. Put it in a [sub]directory representing your CD.
Put your content there.
Create a .cmd file to invoke the browser with a command like,
FirefoxPortable.exe index.html
Create autorun.inf (details googlable) to call the above batch file.
Make a CD image from that directory. There are lots of CD burning applications that can do that.
Test.

Can we use wxWidget to save a webpage onto the disk

I was using wget with system call (c++) to save a webpage from internet to my HD in a program. Now I want to use wxWidget to do the same. Is there anyway I can do that and still have the generic behaviour of wget? (i.e. i give a link to a pdf file n then a pdf file is saved)
I found this link http://wiki.wxwidgets.org/Download_a_file_from_internet
but I have no idea how to convert wxString to a pdf/mp3 file according to the url entered.
Could anyone help please. I am working on an open source project for the first time and I encountered this wxWidget just now
If you are happy using wget with a system call, then why not continue to do so?
wxWidgets is a GUI framework, with a lot of extra convenience functions included. You don't HAVE to use them. You can still use whatever C++ features, utilities and packages that your are familiar with.
Here is a link to Wget for Windows
You can use wxHTTP (as described here) or use wxURL and GetInputStream()