Optimizing Flash CC and swf - actionscript-3

Good evening programmers.
Please do not laugh, but by flash file is 270 MB.
My artists have gave me their final art to me via illustrator.
What I have been doing is opening up the illustrator file and copy and pasting the objects in to flash.
I have movieclips, buttons, tweens and graphics in my library ( 556 items)
How can I optimize my Flash because the swf file is 30MB.
I also have 10 AS3 files, my code doesn't slow the file down, it must be the images.
Thank you.
I've deleted the un used files from my library and have saved the update flash file as another .FLa file.
Hasn't decreased the file that much, still the swf is quite slow when it comes to gameplay.

Sorry for panicking.
When you have complicated shapes and vectors flash takes its time to render the graphics, hence the pause between one frame to another.
To have solved this I had first broke apart the shape and optimized it.
But you see this didn't optimize it to an extent.
The files my artists supplied me with were 100mb - 200mb per file size.
So instead of importing it from Ill to Flash wich was naive I had exported the file to a PNG , which is more than a JPEG but has properties such as transparent background and quality.
What I have done is replaced all my imported images with the PNG version of that image.
Since the PNG is a flat image, it means that FLASH doesn't have to render as much.
Thank you for your comments.

Related

Bitmapdata/bytearray to video file

I just started working with Adobe Flash CS6, and have been trying to find a way to make a game that can record parts of itself. So far I have been able to capture the desired areas of the screen as bitmapData and encode that as PNG and JPEG to byte arrays, and have made an array that I use to store them in order of occurrence. I can use file reference to save them to my computer one at a time, but I need a way to group them together as a video file of any sort. Even as a GIF would do, it may not be video but at least it moves.
Basically I have a bunch of frames collected by my game, how do I get them to someone's desktop as a video file?
If this is impossible for Flash CS6, can it be done with Flash Builder or do I need Adobe Air? I have found multiple methods that work for Air, but I don't have it myself.
You are pretty much answering your own question: you have to encode the data in the right way. Intead of encoding as PNG or JPEG, encode into the video codes that you want.

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.

Bitmap too big as3

In AS3, I am loading a png from a zip file (nochump's zip library through ByteArray to Loader). The png can be up to 45k pixels wide but only 120 tall. This creates a problem in flash, as images can only be ~8000 pixels wide. A possible solution would be to split the images into 6 columns somehow. This would probably need to be done in the ByteArray state, because the limitation is in Bitmap and Loader. Would this even be possible?
I believe you should use Alchemy to decode such a large file and put it in a Byterray. It looks like it has been done for JPEG, PNG shouldn't be very different!
http://segfaultlabs.com/devlogs/alchemy-loading-large-jpeg-images
All things are possible since you have the bytes. However this would require you to write a complete png library in actionscript. PNG is a very complicated and sophisticated compressed image format, so you can't just shred the image into blocks by copying portions of the ByteArray.
So really, the answer is no, it is not possible. Sorry.
If it was an uncompressed BMP on the other hand you would be in with a chance. However I suspect that if you are able to change the format of the file, it would be easier to pre-split the image into columns.

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.

how big is too big for a swf file

I am making a flash game. And I want to know how big is too big for a swf file. Also, Ive been looking at my swf file and right now its at 38.2k. Is the swf file that gets created during debugging, is this the correct size for the file that will eventually be placed on the web.
thanks
Kilobytes is small stuff.
Anything less than a couple of megabytes is fine - once you get above that you might start worrying about loading times and keeping users interested during the preloader, but most portals accept files up to 10MB or so.
Yes, the file is the same. A game of 38.2 kb is pretty small, if you go on Flash game sites they regularly run in the multiple of megabytes.
The SWF is slightly smaller in release mode. The size difference is essentially nothing.
As for a guideline size, this depends on who you are expecting to play your game.
if you want your game to reach a very wide audience keep it as small as you possibly can.
a game without any heavy animation , embedded assets like png files or sound will usually be small.
a good discussion regarding Optimal swf size for flash games here at
http://board.flashkit.com/board/showthread.php?t=788271
The difference between debug and release builds is, according to my experience, some 30-40% in file size (debug version being bigger, of course), which is not insignificant.
Anyways, I think you're safe to assume that anything below 100kb is small enough to be considered an instant download, with no need to use preloaders. However, adding graphical and sound assets to the game will quickly push it up in size, at which point the preloader will probably be a good idea.