Workflow for app variants targeting different versions of Flash Player - actionscript-3

I'm targeting Flash Player 10+ in my application. For Flash Player 10.3+, I'd like to use the EnhancedMicrophone capabilities introduced in 10.3. The difference between the app variants will thus be a couple of lines of code.
Should I create and maintain two separate projects in Flash Builder (and copy any changes from one to the other), or there's a smarter way? Some kind of "preprocessor directives" perhaps that would turn on/off blocks of code depending on the target player?

The following will give the version of the player :
var versionNumber:String = Capabilities.version;
trace(versionNumber);
For me on windows it traces this :
WIN 11,5,502,146
You can parse that and get the 11,5 part for the major/minor version and execute code based on that.

Related

Facebook with actionscript 3 on Flashdevelop : JSON Conventions Issue

I'm trying to use Facebook with Actionscript 3 on Flashdevelop, i've been following this tutorial about setting Facebook :
http://supertommy.me/content/2012/getting-started-open-graph-as3/
The code seems to be clean but i get this error :
WARNING: For content targeting Flash Player version 14 or higher, ExternalInterface escapes strings using JSON conventions. To maintain compatibility, content published to earlier Flash Player versions continues to use the legacy escaping behavior.
I checked the flash player target on my Flashdevelop in the project properties, in tab Output the flash player was set to 10.1, am i missing something ?
Use the clause at the end:
content published to earlier Flash Player versions continues to use the legacy escaping behavior.
as a warning that newer players may render the JSON string differently than the one in FlashDevelop, so you may need to test using a newer debug player as well to avoid security issues.
References
Adobe Security Bulletin: APSB13-08
V-100: Adobe Flash Player Bugs Let Remote Users Execute Arbitrary Code

Adobe Flash Builder

Is there any way which can be adopted, to create cross platform responsive mobile apps using Flash Builder ?
We are using our custom written Resigning Engine for this purpose right now, but we tend to replace it with any generic Resigning tool or to cater responsiveness for all kind of devices/platforms.
Being on the same cross platform development, i.e. Flex, Action Script and MXML, is there any solution for this?
Thanks
It's possible deploy Flex-apps on Mobile devices, see Mobile app development
at Adobe Devnet more details
You definitely can develop Android and iOS apps using Adobe Air, Flex, AS3, MXML and publish them on Apple App Store and Google Play Store. But it's limited to these platforms, and Adobe is very unlikely to add any new platform to this list.
Pros:
it's really cross-platform. Once your application works on one, it's really easy to get it working on the other; so the development cost compared to native applications is much lower;
you may have some OS specific features/design; using by example OS specific CSS directives;
You perfectly may create an app with a responsive design, all tools are provided, but like for HTML/CSS, it requires a lot of work;
you may access all phone features (sensors, camera, etc...) using Adobe Native Extensions
Cons:
the size of the generated application: as it includes the AIR runtime, even a very simple app will weight around 12 Mb (9 for the runtime + 2.5 for Flex);
the performances are correct but not as good as those of native apps; one of the reasons is that Flex does not allow to use GPU for rendering (but Flex is not a framework for creating games);
it would be costly to get an app looking like a native one, as you would have to mimic all of native components. There was a project to do this (Eskimo), but it looks dead, and the components were not polished enough to be used in production when they stopped the development;
Adobe Native Extensions offer is rather limited, and they are quite tricky to write; (these drawbacks are not strong ones: you can write extensions, assuming you know to write native code; and most of the common features are available as ANE);
like with any other cross-platform technology, there are a few issues that you can't fix by yourself; you just can wait for Adobe to fix them when it's a problem in the compiler or the AIR runtime; hopefully they follow a 3 months release cycle since they launched AIR on mobile;
it runs on Android 2.3+ devices only; and only devices that are matching the minimal requirements defined for the AIR runtime; that is to say, most of the smartphones and tablets, except cheap ones like ZTE products. When a device is not considered as powerful enough by adobe, the AIR based apps are not displayed in the stores.
Some recommendations:
The best way to organize your code is to create a project for each OS, with specifics assets (icons by example) and a specific manifest file (app.xml), and put all of your application code in a library used by these two projects. It will allow you to test your code (Flex mobile project can't be unit tested), and will avoid you permanent modifications of the manifest.
Worflow: it's usually faster to develop for Android, and then adapt you app for iOS, because it's faster to deploy and test on Android device (although you may use the Adobe Simulator most of the time).
Use the latest release of Apache Flex; it handles the high resolution devices. Forget Adobe's release (4.7 and lower)
Test quickly and often on mobile, especially for the responsive aspects.
Use FXG instead of bitmap graphics each time it's possible (i.e. if they arent animated); it's lighter and very easy to scale.
Mad Components
Alternatively, you may consider using Mad Components instead of Flex.
Flex was not designed for mobile at first; MC was. So it's faster (looks like native), and much lighter (although you still need the embedded AIR runtime which weights 9 Mb).

Can we use Flash Player 11 abilities through Flex SDK 4.5.1?

As you know BitmapData has some limitation for image size and resolution in Flash Player 10 (maximum resolution is 8192) and for Flash Player version 11 and later, Adobe fixed this limitation and depends on OS we can have all type of huge resolutions in BitmapData.
But my problem is now I'm using Flex SDK 4.5.1 which base Flash Player is 10.2.159.1.
So is there any possibility to use this benefit of Flash Player 11 with my current Flex SDK with implementing a restriction based on Flash version with something like Capabilities.version or not?
Thanks in advance
Yes. You have to :
add the -swf-version=XX arguments to your compiler settings
add the -target-player=11.X arguments to your compiler settings
optionally, grap the corresponding playerglobal.swc and duplicate your FlexSDK, replacing the original SWC file (this is if you need to access new APIs)
Here is a comprehensive tutorial on how to this, and also a very useful chart to know what SWF version to use.
So is there any possibility to use this benefit of Flash Player 11
with my current Flex SDK with implementing a restriction based on
Flash version with something like Capabilities.version or not?
Generally, I don't think the approach of targeting a earlier version and check the actual one at runtime will work because the Player, even if it's version 11.0, will try to act just like the 10.2 if this the version your SWF was compiled for. See the very beginning of this presentation for more details. Use SWFObject to set the minimum player version for your application.
However, since your need is support for larger images, which is somehow transparent to programmers, I am not sure it is actually disabled for older SWFs. That should be tested.

Migrate from Flash AS3 to AIR

I've been developing a project in AS3 but decided to switch to AIR instead, as I found out it's impossible to save files on user's hard drive without prompt appearing. My question is, what changes do I have to expect? is the code written in same AS3 syntax/style? Did instantiating objects / drawing shapes / positioning system / stage change in AIR? thanks.
Everything is the same from a code perspective, except that the AIR SDK includes quite a number of new APIs that are less restrictive and geared toward application development since the deployment target is no longer a web browser.
If you can, you should take a day or 2 and read thru the documentation so you will know what's available to you. Make sure to select the most recent versions of AIR and Flash Player under Packages and Class Filters: Runtimes so the docs are populated with what you need.

Best way to make a downloadable version of a Flash game?

I already made a game with flash, and I want to provide an easy download for people that would rather play offline. Thing is, i use a folder whole structure to dynamically load content per level. Folder structure looks like this, not that it matters that much:
Game folder
animations
anim1.swf
anim2.swf
sounds
music1.mp3
soundeffect1.mp3
levels
level1.lev
level2.lev
myGame.swf
How should I go to distribute this? Should I just resort to make a zip file for the flash game and assume people know how to extract and open the swf? Is there any other way to port easily as an executable? Perhaps Adobe Air (not sure if this works though)?
Thanks, and please help!
Distributing a zip file is the only option if you really want that structure to prevail. Else,
Embed all the resources in the main (myGame) swf & distribute it.
Provide a html page for people who do not have standalone flash player installed.
Embedding as a single file allows the browser to cache the single swf & allow the player to keep playing offline until cache is cleared. So user might not even need an explicit download.
If you are using Flash Builder it is fairly straightforward to compile the application into a self-installing AIR executable (or DMG on a Mac). It is possible to include the AIR runtime which would avoid potential problems of the user not having the correct flash player for example.
An alternative to AIR would be to create a projector executable from inside the standalone Flash Player or from the Flash authoring environment.
Another option to using a zip file would be to use a free installer creator such as InnoSetup or Nullsoft on Windows, or Packager on Mac. Linux users are generally more tech savvy and so a tar would probably be well understood.
Adobe AIR works wonderfully! I use it for my own project, and your project should transition over to it with little to no modification (any issues should show up in the Compiler Errors and Output). The only downside is that, past AIR 2, there isn't any Linux support.
The other option is obviously to create a standalone .SWF projector inside a zip or installer, but in my opinion, that isn't the sleekest way to deploy for desktop. The advantage of AIR over this is that it gives you access to additional desktop functions that Flash Player doesn't.