Calling C++ code from ActionScript - actionscript-3

Here's the problem: I'm creating my new game which has some inapp items. I am using the Starling Framework for the game so I develop on AS3. I want to protect the game from genius(!) players who may attempt to break into inapp purchase process.
AS3 calls an in-app ANE (Milkman's), when a success returns from the ANE, my AS3 code sends an acknowledgement to my game server. So a malicious player can always send this acknowledgement info to my server without completing the in-app purchase process as if it was completed successfully.
So I thought of creating my own ANE which will also send this acknowledgement after it completes the process, so no AS3 code to mess with. I also don't want to use Java on Android to make things a little harder so I wonder if it's possible to call C++ code (which calls JNI for in-app purchases) from AS3.

Milkman ANE is fine to use, google play has a proper secure way to protect your purchases from hacking - check out billing-security for GooglePlay.
iTunes also has similar solution.
The main idea is to verify a purchase on server side with a private key which is only available for provider store (google play or iTunes) and your backend.

Related

Discord Rich Presence in AIR?

Discord released a Rich Presence SDK that lets C++ developers integrate their game with Discord, which really is an extension of their existing RPC server built into Discord. Lately this SDK has been ported to more and more languages, including Java and Javascript. I know AIR can interface with Javascript, but they seem to use node.js which could be messy.
With all of these new wrappers popping up, what would be the best way of going about this for an AIR app? I'm trying to figure out the most efficient method for creating an AS3 version but I'm not sure which path is the best.
Edit: I don't even want the fancier features, I just want to be able to set a user's local Discord client to display extra game info.

Sending data between 2 flash apps

I would like to create android/ios app that has a feature like candy crash life sending.
Is it possible in as3 to create such thing?
Do I need to use a server side or it can be done with flash and as3?
Short and simple: YES, most definitely you'll need server.
Also, bear in mind that if you plan to sell goods in the game or similar - you will need to verify the data send from the flash on the server. It's pretty easy to decompile the swf, make changes to say have unlimited moves, compile again and play.
If you're planing that, I'll suggest to make more research on how to make a "secure" game, since flash in general is considered as unsafe...

Using Bluetooth ANE for Android

I'm relatively new to flash, air and AS3 so I'm sorry if this comes of as a beginners question. I have made an application in AIR to run on windows and communicate with my atmega8 chip through serial communication via serproxy.
Now I want to port that application to android to perform the same basic functions but communicate to the atmega8 via bluetooth. So I created a new Air for android file in Flash CS6 copied my code from my previous application excluding the communication through sockets part and created an apk which ran on an android phone:). It did everything except the communication as expected.
Now I have been trying to implement the as3breeze.com/bluetooth-ane and use it to communicate but I'm not too sure how to go about the whole thing. I have imported the ane through actionscript settings and have implemented the classes but when I try to test I get this error.
The content cannot be loaded because there was a problem loading an extension: Error: Extension namespace is invalid for C:\Users\AppData\Local\Temp\Tmp_ANE_File_Unzipped_Packages\AndroidBluetooth.ane
So after some searching I found posts talking about as3 sdk and flash builder. Do I really need all these things or can I make my bluetooth app work some how with just flash cs6? Also what exactly does my error mean and how can I solve it. Thanks in advance for any help. I have been searching so a solution to this for days and I either get an explanation that does not work or I lack the knowledge to understand.
The path that can't be accessed makes me believe you haven't extracted the ANE (basically you're trying to access a temporary directory). Try extracting the ANE file to somewhere, like My Documents or wherever your flash project is, and include (in the actionscript settings) that path instead.
Hope it helps.

Adobe air or flex?

I am starting with my first application development. So far I have worked only with Html, css, js, jquery etc..
I want to create an app like the desktop gmail notifier which pings the server at regular interval, look for any messages and notifies the user. I read that Adobe Air and flex are the tools that can be used for this. I have developed the basic prototype in adobe air by studying the tutorials in net.
But the problem is that, my client doesn't want the source code to be made available to users. With air, you can see the complete source code after installation/unzipping the .air app.
Is there any way I can protect the source code? Or should I use flex and convert it to a swf? Is the source codes are protected in flex? I am not familiar with the flash action scripting. Please advice.
I think you are confused as to what Flex is. It is an SDK that is a level below the AIR and Flash SDKs. Flex is a secondary structural language that is meant to be used in conjunction with AS3, while AIR is compile-type.
It doesn't matter how you compile this, the source code will be attainable if someone really wants to get it. If you compile as an AIR app, you can unzip and get the SWF file. If you compile as a SWF, you already have that SWF. The SWF can then be decompiled using various tools.
There is no real way to hide front end code from prying eyes. Flash is definitely harder to read than HTML or CSS or Javascript, but definitely not impossible to view regardless of how you compile. Your best bet is definitely to offload as much as possible to a server and possibly obfuscate your code.
I would definitely try to explain to your client that it is simply not possible to truly hide source code from individuals who would like to access it. If someone really wants to steal the code, they can and will.
Code cannot be hided in any front end technologies, Flash (SWF, Flex or AIR) or HTML (JavaScript).
Do all the business logic at server and authentic properly for securing your data.
And AIR and Flash Player are both runtimes which play applications written in Adobe Flash or Apache Flex.
You can use a client-server implementation to hide the logic from the user and flex would just render a UI based on the business logic from the server side code(php,java or .NET) that interacts with the gmail servers
If you want proper notifications, go with AIR - access to some system-level features like toast notifications. With Flex, you'll be limited to webpage content.
About code protection - you can develop app in ActionScript and then protect compiled SWF with obfuscator for some fair defense, although there's probably no good free obfuscators. I paid some bucks for secureSWF license and consider it a good investment. Of course, determined hacker would crack app anyway (in theory,) but I would'nt worry about this too much for a simple pinger app.

AS3 USB game controller support

How can I make a USB controller control my AS3 game. I'm using the keyboard right now and I have thought about mapping the keys but I have to use a plugin for that and I just want users to be able to buy a simple controller that doesn't need any driver downloads/configuration. They should be able to plugin the USB controller and play the game through Flash Player in a browser.
One possibility... you can tell your users to download joy2key. http://electracode.com/4/joy2key/JoyToKey%20English%20Version.htm
I admit that this is not a "real answer" to your question. But it is a stop-gap solution until you figure out and implement the real solution.