An easy solution would be to have a text file that your app reads in, that has the data needed for the predictions. Then you would put that text file online somewhere, and the app would read the file from its URL. You could easily replace the file to make the predictions be up to date.
Ok , this is a correct answer!
Any ideas how i can make this answer to work?
Where can i upload the text file?
How can i call it from my app and open it in a frame in my app?
So Mr Preran i believe correct answers must give from the person have the questions !
Correct answers are best when the person who asks the question selects that. But also, moderators can decide to do that, so that anyone else later on can see that the topic has an answer. Moderators can also unmark a correct answer, which I will do! Then I'll post another answer, which you might like more.
1 person found this helpful
Try this code in a new AS3 FLA, to get the general idea of how to retrieve text from a file that is online somewhere. Then, think about how you would structure the text so that you can easily extract information to update your app, and change the example URL I used to the URL of your own text file (which you will upload to the server using FTP):
var req:URLRequest = new URLRequest("http://txt2html.sourceforge.net/sample.txt");
var ldr:URLLoader = new URLLoader();
I build a webpage on 000webhosting and i call the page with the predictions with this code:
var swv:StageWebView = new StageWebView();
swv.stage = stage;
swv.viewPort = new Rectangle(0, 250, 440, 400);
The page open in the application in the frame where the code is.
I try your example and its work, but with my way is that i want!
Thank you for your help very match!
I was wondering if there is any chance when the page open in the mobile, to save the page so the second time
the user open my app to not need to have internet connection!
There is a slight chance that Apple may not approve your app, because it will be clear to them that you could easily completely change the content of the page after the app has been approved. But maybe they won't, seeing as there are various ways to get around their limitations.
I can't spend the amount of time to show you all of the code you'll need to do, but these would roughly be the steps (two different approaches):
1. Where you only update files that are changed
In your app bundle you would have a copy of the web page files. When the app is first run you would copy those files into the app's document folder.
One of the files would be a list of all of the other files, and what their last modified date is.
You then read the same file from the online page, in the way I was telling you before. Then you go through each line in the file to see if any of the files have been updated.
You would download any new files and write over the local copy that is in the app documents folder.
At the end you show the local copy of the page. Also, if when you start the app you can see that the user is offline you would immediately show the local copy.
2. Where you always copy everything
First part would be the same, you would create a copy of the files for the web page in the app's documents folder, only this time do it by extracting a zip file.
Then each time the user looks at that page you check to see if an online version of the zip file has been updated, and if it has you download and extract all of the files again, replacing the local copy.
If you do use the zip file approach you should look at this ANE: http://www.myflashlabs.com/product/zip-ane-adobe-air-native-extension/
i appreciate your help!
Thank you very match Mr. Colin!!!