Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chiefroastbeef

macrumors 6502a
Original poster
May 26, 2008
909
0
Dallas, Texas/ Hong Kong
Hello all,

I currently have a flash file that is 2.3mb. The file is just comprised of a couple images, with a paragraph at the end of the movie, lasting around 17 seconds.

I've tried flash optimizer, the free trial version. It works great, but it'll only save the file in black and white, and I much rather have it in the original colors. I am unwilling to pay $99 for the program that I know I will not use much.

Is there another way of optimizing a flash file? Or should I just redo the whole thing using optimized images? If so, do i just optimize with fireworks(which I have)?

Thanks for the advice!

chief
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
Yeah, TOO MUCH INFORMATION.

Of course, attention to detail is a good thing, usually.

Now, about that Flash stuff...

Did you try THIS freeware Flash optimizer?

Also, the images themselves could (and should) be optimized before being inserted as objects within Flash. Adobe PhotoShop -> Save for Web and save as a JPG and optimized accordingly, for example, or use one of the online optimizers like this one. Optimizing reduces redundant pixels, uses the least amount of colors in the best possible palette (bits) which reduces file size. You mentioned the images stuff in your post so I suspect they're not small and might factor in to overall .swf filesize.

-jim
 

snickelfritz

macrumors 65816
Oct 24, 2003
1,109
0
Tucson AZ
  • code your project in Actionscript 3.0 if at all possible.
    you can expect up to a 10x improvement in performance from this factor alone.
  • complex vector graphics that are not transformed at runtime can be cached as bitmaps.
    object translations, such as changing the xy coordinates are fine.
    Code:
    circle.cacheAsBitmap = true;
  • eliminate transparency masks whenever practical, by setting the background of objects to opaque.
    This reduces the vector information to a simple rectangular bounding box.
    This is especially valuable with complex vector graphics such as logos.
    For example, a movieclip that contains a circlular shape, instance name "circle" will, by default, include a circular transparency mask.
    If the site background is a solid color, 0x0066FF, for example, you can set the background for the circle movieclip to the same value.
    Code:
    circle.cacheAsBitmap = true;
    circle.opaqueBackground = 0x0066FF;
  • load external assets dynamically instead of embedding everything into a single SWF.
    this reduces the initial loading time for the site, in some cases dramatically.
  • remove event listeners and references to objects when they are no longer needed.
    this mitigates the potential for memory leaks, and reduces overall memory overhead.
  • use multiplication instead of division in your actionscripts; it usually executes faster.
  • use strict datatyped variables and arrays to store objects and properties.
  • use "int" for numbers whenever practical; it's slightly faster than "Number" and significantly faster than "uint".
  • oversized SWF files will tend to run slowly.
    it's analogous to video games; 1600x1200 will always have a lower framerate than 800x600.
 

chiefroastbeef

macrumors 6502a
Original poster
May 26, 2008
909
0
Dallas, Texas/ Hong Kong
Thank you all for the suggestions above! I will do it over again(it doesn't take too long) with the what you guys have suggested.

The flash optimizer program is great, however, the free trial only saves the optimized file in black and white, not with the original colors.

Thanks again guys! This is great stuff!
 

snickelfritz

macrumors 65816
Oct 24, 2003
1,109
0
Tucson AZ
It's customary to include a progress indicator for large SWF files.
(500K is a relatively large SWF)

A good way to do this is to create a parent SWF that has nothing in it but an empty loader object connected to a simple preloader script, and a progress indicator on the stage; your main content SWF is loaded into this loader object from an external directory on the server.
The external SWF files could also have their own loader objects and scripts as well.
You could literally have dozens or even hundreds of content SWFs stored on the server without the download/memory/stability problems associated with bloated single SWF solutions.

This is an ideal way to construct Flash applications for distribution over the internet, since the speed of the client internet connection becomes less of a factor in terms of delivering a large amount of content spread across several sections of a Flash website.
Imagine a single SWF file that has dozenss of images embedded in a gallery, an interface, a contact form, and several text pages; the filesize would quickly become far too large for practical internet delivery, and the FLA would be a nightmare to edit.

Here's an example script that fades-in a progress indicator, which runs until the file is fully loaded, then fades-out the progress indicator, then fades-in the loaded content.
Paste the script into frame1 of a new FLA with the same dimensions as your main SWF.
(named "main.swf" in this example)
The TweenLite class is used here for smooth alpha transitions for the preloader and loaded SWF.
Download the TweenGroup class and place the gs directory in the directory as your FLA. (the download includes, TweenLite, TweenGroup, TweenMax, some useful utilities, and some good easing classes)

The progress indicator is an empty Dynamic TextField with fonts embedded, wrapped in a MovieClip on the stage: "preloader.preloadText"
Compile the loader.swf and embed it in your HTML page.

PHP:
import gs.*;
import gs.easing.*;

/*---------------------------------------------------------------------------------*/

TweenLite.to(preloader, 0, {autoAlpha:0});
var mainLoader:Loader = new Loader();
mainLoader.x = 0;
mainLoader.y = 0;
mainLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
mainLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
mainLoader.load(new URLRequest("main.swf"));// this loads your content SWF

/*---------------------------------------------------------------------------------*/

function onProgress(e:ProgressEvent):void
{
	TweenLite.to(preloader, .4, {autoAlpha:1});
	var percentage:Number = e.bytesLoaded / e.bytesTotal;
	preloader.preloadText.text = Math.ceil(percentage * 100).toString() + "%";
}
/*---------------------------------------------------------------------------------*/

function onLoaded(e:Event):void
{
	TweenLite.to(preloader, .2, {autoAlpha:0, onComplete:loadMain});
}
/*---------------------------------------------------------------------------------*/

function loadMain():void
{
	removeChild(preloader);
	preloader = null;
	addChild(mainLoader);
	TweenLite.from(mainLoader, .2, {alpha:0});
}
/*---------------------------------------------------------------------------------*/
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
Great advice. As a user, I appreciate it when developers add that - it's not only professional looking, but I don't sit there wondering if the site bombed, so a progress indicator is the way to go. And don't forget add a way to "skip" any Flash Intro which is optional viewing.

-jim
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.