How can i add some score stored in a variable to a SQL database from a SWF? - AS3 - sql

I have a game in SWF with AS3 that scores points and stores it on a variable called "Puntos". Here's how I'm doing it:
stop();
var puntos:int = new int();
add_puntos.addEventListener(MouseEvent.CLICK, agregar);
function agregar(event:MouseEvent):void
{
puntos=puntos+3;
puntos_txt.text=String(puntos);
trace(puntos);
}
Now, i have to take the result of the variable "puntos" and add it to the absolute score of the player on a SQL Database. ¿How can i do it? :(
UPDATE: Thanks Andrey. Effectively, it's not for mobile. I'm going to try it :)

You need backend knowledge in order to save those scores (or if you are working on a mobile - at least SQL knowledge).
The client part is easy - sending a simple POST request to the server, where all the magic happens. You can see the examples here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html#includeExamplesSummary
If you are working on a mobile - things get harder, and you would need go search Google instead :)
Edit: Having in mind you are using mobile device, this is for you: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118676a5497-7fb4.html

Related

PHAsset - Property way to save captured PHAssets locally? (in app)

trying to understand the concept for Photos/Photos.h framework.
my goal is:
write captured video url (or asset) to app's "userDefaults".
read from "userDefaults", & fetch each saved asset data (thumbnail & url)
Since you're not providing any code (nor asking for any), I can help sort some of this out for you -- but you need to study a bit more before you can put it all together. Especially if you think you've asked a question which has one simple correct answer.
UserDefaults is not a good place to store an image. Images are big. (You should look at Apple's documentation of what UserDefaults is for/how it's intended use).
UserDefaults
There's more than one place to store images. Do you want the system to delete them if you start running out of memory? Then it belongs in cache:
let cachesPath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).last!
Do you want to depend on it being around the next time the app is run? There is a standard place for that as well:
let userDocumentsFolder = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
Do you want iTunes to back up the images for you automatically? It expects files to be in a certain place for automatic backup. Do you have a way to keep track of where it is (the path to the file can change if the app is re-run). For that you might require persistent storage, so CoreData or Realm might be an option for you. Or you could scan your directory and create a list of files you've already saved. Then you'll need a way to select the correct one. (What did you call it? Should the user select it?)
Apple has very clearly written and useful documentation on access to the Photos library and using PHAssets. Here's just one example:
PHAsset - Photos
There are a lot of talented people on this site, and they are willing to help you, but you need to do your homework before coming here.
I recommend you read these linked documents, start writing some code, and if you run into problems please come back and ask any specific question you have about any specific problem you've encountered. Include the code which causes the problem, as well as the exact error message you are getting. We will be glad to help.

Bulk extract with Authenticated Connector (import.io)

I am new to import.io and this forum.
I am trying to extract information from a target database where I have to run a query with an input. With help of the support, I successfully created the authenticated connector. With multiple inputs that have to be manually entered in the UI, it fetches the data properly.
The problem is I have more than 10,000 inputs to run, so it has to be in a form of bulk extraction. import.io support told me that they do not have this feature within their UI and suggested to use their API posted in here: http://api.docs.import.io/#!/Query_Methods/queryPost.
Could anyone walk me through to make a use of this? I just need a working script that takes multiple string lines as inputs and run the connector that I built and post the result. I am not very familiar with this kind of technology but I am very willing to learn.
Thanks all in advance!
I would be happy to walk you through a bit of an into. It will be a bit basic though since I don't know your specific use case.
Yes, support was correct. You will need to use the POST query in order to pass your authentication credentials as inputs.
I will break down this query by steps. Essentially, our API docs are just a simple UI to pass through your credentials, then you can generate a query API.
ID - This is the GUID of your connector. This information can be found at the end of the URL, like this: https://import.io/data/mine/?tag=CONNECTOR&id=33f4e828-25ce-40c4-948c-9b734c70d1ab
Query - This is where you will put the inputs from your connector in order to execute. Be sure to keep this in structured JSON or it will bring back errors when you are querying.
Once you have successfully entered that information you will query the API.
This will give you the request URL that you need to query the API.
If you have anymore questions, just let me know.
Thanks,
Meg

Counting the amount of users or executions of an application.

I made a program that gets the data from the clipboard and saves it in a string variable. Then it looks for specific words in that string and generates several URLs. Afterwards it open the browser and shows each URL in an own tab.
Some of my friends already use this program frequently and I want to have some statistics about how often. I simple counter variable would be enough but I need to get access to it.
I came up with two options that could work:
I could send an email to a specific adress every time my app is executed. Then I can track the amount of uses by manually or automaticly counting the amount of emails in the postbox. I think this would be a Vers dirty solution.
I could create and publish a website containing a counter. This counter could be refreshed by my application. This solution is a bit better I think but a lot more work for just one single counter.
Do you have better ideas to solve my problem or is one of mine already a good one?
Thank you in advace!
You can use Measurement Protocol Overview. This provides you statistics of usage your application compared with Google Analytics. You can see even a geo statistic, version distribution, crash reports. It is easy to use it from .net. It is just about requesting http request to google.

Using JSON to update app's content in iOS

I'm about to create an application that uses JSON to update its content.
This is how I planned it to work:
When application starts, it checks (with internet connection is available) if the JSON file set on remote server is newer than the one stored localy - if it is then it's downloaded.
Then, the application applies data from that JSON to the content. For example, to the "Contact" information - it applies data like phone numbers etc.
My question is, is it in your opinion, a good technique to update appliactions content?
Does anynone had an experience with building app with this kind of idea?
Best regards,
Zin
Of course you can do this. One thing that may lead to a better user experience would be to ask the user for his permission to download new content (if there is something new).
This is a normal thing to do. I have a phonebook app that does exactly this. On a side note, if you need a network class to handle the web-service interaction, see this SO post. I wrote a custom network class that works with AFNetworking.

Apple Appstore name search via the API?

Is it possible to do a search for apps by title via the API? For example, the equivalent of "Return a list of apps (if any) with the word 'dog' in the title".
I've seen two access points that come close, but don't seem to offer this:
The RSS feed; it lists apps, but apparently only groupings like, "top 100..."
The query interface; but it doesn't seem to query over the app media type. (?)
I found the answer. Although not explicitly documented, it's possible to search by app name.
http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
You're right, it wasn't very clear on that iTunes page at all. The parameter entity=software is the key. For example, here's a search for my app, TypeLink:
http://itunes.apple.com/search?entity=software&term=typelink&callback=myCallbackFunction
If you're wondering what the callback is for, here's some more info on the JSONP format it uses:
http://en.wikipedia.org/wiki/JSONP
For any future person who wants to link to the App Store keyword search result page directly from a web link - this format works as of April 2013:
http://phobos.apple.com/WebObjects/MZSearch.woa/wa/search?media=software&submit=media&term=KEYWORD%20GOES%20HERE
Was a PITA to figure out but finally got the syntax right... Needed this because a client has apps made by multiple developers so I couldn't just use the suggested Appstore.com/DeveloperName link to return all their apps.
Thanks all for sharing wisdom. Hope this helps someone.