Scale Flash desktop app to iPhone/Android phone size - actionscript-3

I have several games that were built 800*600 and need to convert them to run on the iPhone.
Are there any "easy" frameworks to convert the application without having to create all new images for Flash/AS3?
I was reading about starling but I don't see any way to easily convert our application witout rewriting a lot of it.
Thanks.

It totally depends on your existing games. If they use a lot of vector graphics and full screen animation, performance will become an issue. But if you use a lot of bitmaps already, and not much animation, you might get away with just porting your games to AIR.
Flash CC has options to export assets to Bitmaps even if they were created using vectors ("Export as Bitmap").
You can optimize performance by using cacheAsBitmap on certain graphics (also look at cacheAsBitmapMatrix) but there you will enter rewrite territory.

Related

Can I use the effects made in Adobe After Effects in the game developed with Adobe Flash Pro and ActionScript 3? If so how?

I am developing a 2D game using Adobe Flash Pro CS 6 and ActionScript3. I am having some trouble in developing some effects e. g. bomb blast, particle effects etc. I want to know, whether I can use After Effects for those and then use them the game. Please suggest me.
There's no problem of using any graphics data from any program in Flash as long as flash can support the file format.
In case of After Effects graphics, you'll probably have to export them as a PNG file sequence, so they'll most probably be pretty large in file size.
To import:
You can either make a movie clip and just import the first image of a sequence with CRTL/CMD + R and Flash with be "smart" enough to suggest to load the other files of that sequence.
If you want, you can load them during run-time, add them to the array/vector, create a Bitmap object and change it's bitmapData property on enter frame/timer to animate it.
If you are decided on using the actual After Effects graphics rather than emulating them using an Actionscript 3 particle effect, I'd actually recommend exporting them as video on an alpha channel and then converting that to flv and then hosting them individually and streaming them in via Netstream and placing them on the proper layer via an addchild. If bandwidth isn't a huge concern here, this would be a good method for achieving this effect.
Here is some documentation on Netstream. http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d4e.html
If this seems like it might achieve the desired result, I can explain further if needed.

Is Starling worth implementing for my AS3 MMO?

For the past year I have been working on an isometric city builder. So far I have not used any framework apart from a loose PureMVC clone.
I have heard of Starling but only recently have I played with it.
From my research, the performance boost is fenomenal, but this forces me to manage my resource a lot tighter.
At the moment, I am exporting building animations one building at a time, in ~16 frames/pngs. These are cropped, resized and exported in Photoshop by a script and then imported in Flash, then exported as a swf, to be loaded / preloaded / postloaded on demand.
The frames are way too big to make a spritesheet with them, per building. I believe its called an atlas.
These pngs are then blited between lock() and unlock(). After the buildings + actors walking around are sorted, that is.
I am unsure if just using starling.Movieclip for the buildings, where instead of loading the pngs, I would build a MovieClip symbol with its frames. So bliting wouldn't even be necessary. Unless adding bliting on top of Starling would improve performance even more. That would allow fatter features such as particles effects, maybe some lighting.
Google isn't offering me a strait answer, thus I am asking here.
Google isn't offering a straight answer because there isn't such. It depends very very much on what you've done, how much knowledge you've got and what are your goals.
Using Starling gives benefits as well as drawbacks. Your idea of resources will change totally. If you really have enormous amount of assets, then putting them into GPU will be really slow process. You must start from there - learn what Starling does, how resources are managed with it and what you need to change in order to make the transition between the two.
If this is not that hard and time consuming task, you will have some performance optimization. BUT again it depends on your current code. Your current code is really important in this situation as if it's perfectly optimized your gain won't be that much (but commonly would still be).
If you need to switch between graphics regularly or you need to have dynamic assets (as images for example) you must keep in mind that uploading to GPU is the slowest part when talking about Starling and Stage3D.
So again, there is not a straight answer. You must think of GPU memory and limit, GPU upload time, as well as assets management. You also need to think of the way your code is built and if you are going to have any impact if you make the switch (if your code heavily depends on the MovieClip like structure, with all that frames and things) - it will be hard for you. One of the toughest things I fought with Stage3D was the UI implementation - there is almost only Feathers UI which will take you a few weeks to get along with.
On the other hand, Starling performs pretty well, especially on mobile devices. I was able to maintain a stable 45fps on a heavy UI app with a lot of dynamic loading content and multiple screens on an old iPhone 4S, which I find great. Latest mobile devices top at 60fps.
It's up to you to decide, but I'll advise you to have some experimental long-lasting project to test with, and then start applying this approach to your regular projects. I've done the dive to use it in a regular very tightened deadline project, and it was a nightmare. Everything worked out great, but I thought I would have a heart attack - the switch is not that easy :)
I would suggest using DMT for rasterizing your vector assets into Straling sprites at runtime, and it'll also keep your DisplayTree! meaning that you'll still have the parent/child relations that you had in your Flash Assets.
DMT will not duplicate assets, and will rasterize the vectors into texture atlases only one time (Cache is saved)
you can find it here: https://github.com/XTDStudios/DMT

Refactoring for starling

I'm making a flash app for AIR. The app is mostly made, but I'm not happy with rendering speed on mobile (render mode - gpu).
I know there is a framework that allows user-friendly way to work with Stage3d called Starling, but I've never used it.
After looking into it and following through some tutorials I've noticed that I need to rename all package flash default classes, e.g flash.display.DisplayObject -> starling.display.DisplayObject.
But such action might be destructive to my code base, plus, I have other frameworks attached that work with some flash package classes.
Is there a way to attach Starling to a complete project without re-naming all the package names, changing assets and re-factoring all frameworks that work with default AIR API?
If you're thinking of switching to Starling, you'll have to redesign your whole rendering code. Starling is no drop-in solution. Just renaming classes in your existing code will not do because it completely replaces flash display list for Direct3D, which does all it's rendering with GPU, with all the differences it brings: bitmapped graphics, texture atlases, careful draw ordering. Learning curve can be a bit steep in the beginning but once you get familiar with basic concepts it's a breeze to work with.
IMHO, it's well worth the effort, especially on mobile. Code that ran in low 10s of FPS in classic display list can easily be made to run at solid 60fps with Starling. Basically, for flash on mobile, Stage3D is the only game in town. And Starling is the best supported and widely accepted framework for 2D stuff on Stage3D, with lots of supporting libraries and a very helpful community of developers.
Go on, take the plunge, you won't regret it.
You can run Starling and a native flash application layer at the same time but it wouldn't give you an optimum experience.
If you want to take full advantage of the gpu acceleration of Stage3d and Starling though it would be preferable to refactor your existing code to use Starling display objects rather than Flash display objects.
You might want to post this question on the Starling forum, they are very helpful guys and it's a thriving developer community! - http://forum.starling-framework.org

as3 Why use starling for games on Android and IOS devices?

I have a nice setup where I publish, compile, design, etc. in Flash Pro CS5.5 and write as3 code (and some xml) in Sulbime Text 2.
Being forced to import each image or generate a sprite sheet seems like a such a hassle for nothing.
My apk apps work fine use mouse events, so what's the point in switching to starling?
I can answer you with 3 letters FPS.
You are getting a big boost in performance as you are working with law level API of Adobe Stage3D. And you do not need to worry about how to handle it because starling is warping it for you with nice 2D game Engine.
I suggest you to work with Starling for core game development and Gazman SDK for UI.
How ever there is one problem with starling. It does not have native support for vectors, so scaling could be a problem in many cases, spatially when building android application that you want to support in many screen resolutions. You can read this post about starling solution for that problem.

how to optimize illustrator artwork in flash?

I'm working on a flash project that incorporates a lot of artwork done in Illustrator CS4. I've been copy-pasting directly from Illustrator into Flash, and I add some animations as well. Final file is going to be a one single swf file which will be a part of UI for an application and .net will be the core for this. But now flash becomes unusable slow to respond for actions.
My machine is a fast i7 with 6gb of RAM, so I don't think that's the issue. We are going to use this file with dual core atom processors. Does anyone have ideas for alternative importing techniques, optimizations within illustrator, anything at all that will make this more manageable?
Thanks
All you need to do is to save your vector file in EPS10 format. In order to reduce the EPS file size it should be enough to reduce the linear dimensions of our artwork. It can be done with the help of Selection Tool (V) or command Scale (Object > Transform > Scale).
Even though the stuff you're pasting from AI is vector, Flash becomes very slow when trying to render all of those objects on the screen. Under the View menu, select Preview Mode, then Fast. The images will look jaggy on the screen, but the interface will be snappier.