Monday, October 03, 2005
Optimization tips.
Wow, have I been busy as of late. In hopes of maintaining food entering my body and a roof over my head I've been working like a dog as of late. Top that with Flash 8 coming out and I have been a busy boy.

Don't believe me?

Mishka NYC
Self Made TV

Ok, two sites for all this time of absence? I know it doesn't look like a lot, unfortunately, most of my recent work has been cleaning up after people's rather creative Flash skills. As a result I wanted to address some things that you can do to optimize your own work, this way I won't get a call to clean it up =) (wow that was really mean an cocky).

OK optimization:

1. Try to avoid using JPEGs. Its been my experience that JPEGs bloat file sizes. I am uncertain as to what is actually going on, if there is some sort of bug going on with the internal Flash compression battling the JPEG compression for dominance which results in bloated file sizes. Also to make your life easier its better to have a non-compressed file in the Flash movie, so you can adjust the compression across the file as opposed to on an individual basis.

Use PNG files, you'll see a difference. If you don't believe me, experiment for yourself, create two identical Flash files one with a JPEG and one with a PNG and play around with it.

My preference is for PNG files, and I've noticed a considerable size difference, but don't just trust me, see for yourself.

2. Crop and resize bitmap images to the exact size you need. Bitmap files bloat file sizes, the bigger the image, the bigger the file, so if you import a file and then reduce it 50% you still have the file weight if it was at 100%. Also file appearance degrades if you blow up or reduce files. Its best to have them at 100% and cropped. Try to avoid cropping images with masks.

3. Try to use a top left align for your symbols. Believe me, as someone who will have to clean up after you =) its easier for me if you use a top left registration. This will help you in the future when you begin scripting more, its easier to calculate the movieclips position if its registration is at 0,0. It'll take some getting used to but believe me you will appreciate it in the future.

4. Don't use graphic symbols. Graphic symbols have only one purpose I can see, and that is for doing synched animations. If you have a one frame symbol, make it a movieclip. It would also help to get in the habit of giving your movieclip instance names as well, this is more for scripting, since you can control any movieclip that has an instance name.

Graphic symbols are best used when you are hoping to synch audio with visual, for lip synching, or other time oriented animations. You can put all of your animation into a graphic symbol then put that symbol on the stage set to play once in the symbols property window.

5. Try to avoid embedding large audio files. Flash has pretty much mastered loading external MP3 files, take advantage of that. MP3 files can stream on loading, so you won't loose much by loading it as an mp3 file and you will keep the file size down. Loading mp3 files are actually pretty easy, reference the Sound object in the Flash help files.

6. Keep the actions on one layer and at the top. I'm an old school Director programmer, Director has its script channel at the top, it means all the code is in the exact same place all the time. Flash isn't the same.

Because you can put code on any layer, any frame, finding all the code sometimes can be frustrating. Its best to move it all to the top in a layer labeled "Actions" this way not only can you find it, but others will be able to locate it as well.

7. NEVER use gotoAndPlay() to go to a frame number, always give it a frame label. Frame numbers can change when you add or delete frames, once that happens all your code is useless, using frame labels allows you to add and delete frames without having to worry about any code that specifies a specific frame.

To be continued...
 


Comments:
Johnny,

I was reading up on your tips as I am one of those creative flash designers that you love so much.

Could you tell me a little more on best practices to synch up flash animations to audio files. We are building a site that is contingent on animations (builds) synching to long voice overs. Locally it works fine, over the web, the tweens slow down and the animation and voice over do not synch. I'll be glad to share any more details, etc. - let me know the best way to continue communicating.
# posted by Blogger Bram : 12:51 PM
 
So old tips =)

The trick I use to synch up audio and animation in flash is two fold:

1. Set the audio to Stream, not Event. This will force the audio to be frame based. Hopefully you are using a FPS of 24 or 30, if not I highly recommend you change it to one of the two (preferably 30). This will cause you to have to adjust your animation so be prepared. In the case of event based audio, you have to have a frame per audio, otherwise it won't play. So you'll have to make sure the timeline is long enough to encompass the audio.

2. I create my animations as movieclips, but then I place them on the stage as Graphics. In the object inspector I set the graphic to "Play once", this forces the graphic to play the movieclip as a frame-based animation. This will also require as many frames on the main timeline as there are frames in the movieclip.

Unfortunately I had to disable the contact form on my site because of spammers but you can follow up with me using [storm][at][johnnystorm][dot][com]. I get a lot of spam on this account so please put a reference to the website in the subject.

Cheers

-John
# posted by Blogger Johnny : 1:12 PM
 
Post a Comment

<< Home
ARCHIVES


Powered by Blogger