Skip to main content
tnbnicer
Inspiring
April 2, 2018
Answered

How can I shrink the overhead in AS3 compiled Flash movie?

  • April 2, 2018
  • 1 reply
  • 529 views

Hi.

I've been converting an animation previously compiled with ActionScript 1 to ActionScript 3. Not a huge difference, but AS3 has a few bonus features.

In this day of ultra-fast broadband file size is not much of an issue for most, however I acquired the habit of shrinking everything as much as possible back in the bad old days, and find the habit hard to break.

AS1 file = 57 kb

AS3 file = 63 kb

Notably AS3 exports AS3 classes (in bytes):

11401 Scene 1 (AS 3.0 Classes Export Frame)

compared with (in bytes):

2771 Scene 1 (AS 1.0 Classes Export Frame)

Font subset embedding has gotten more expensive overhead-wise as well:

Verdana = 8244

Tekton Bold = 4472

OCR A Extended = 3800

compared with:

Verdana = 6297

Tekton Bold = 2493

OCR A Extended = 2505

Movie A is Flash 9 compatible and Movie B is Flash 8. Why are fonts bigger in Flash 9? Has anyone else noticed this? I made the Flash 8 movie on Windows Vista originally, and the Flash 9 version on Windows 10, where fonts are larger. Could that account for it? I generated the size reports in Windows 10 for both.

Also, can AS3 classes be optimized?

Thanks.

Tom

This topic has been closed for replies.
Correct answer kglad

you manually control classes by using class files.  start with the document class.

1 reply

kglad
Community Expert
Community Expert
April 5, 2018

actionscript 3 was designed to be faster, not smaller.  for smaller file size you would need to use fewer classes.

font sizes wouldn't change because of flash/animate.  they would change based on the os font size and the characters being embedded.

tnbnicer
tnbnicerAuthor
Inspiring
April 6, 2018

Thank you for the answer.

I haven't tried Animate, though I suspect font sizes are closer to those in Flash 9. If the size reports are true, embedded fonts are smaller in Flash 8 than in Flash 9. Fonts in Flash 9 seem to have more data. Some fonts are bigger in newer Operating Systems, because they contain more character subsets. The fonts embedded in Flash are limited to the characters in the movie. "Hello World!" is HWdelor!. There shouldn't really be any increase in the size.

As far as optimizing ActionScript 3 goes, I was thinking that there might an option to override classes that are imported by default; you could manually import classes as needed like in Java, but I don't believe there is that option.

Classes designed for speed may or they may not compensate for the larger file size. I'm pretty neutral on the issue. I haven't noticed that the AS3 movie takes longer to load than the AS1 movie, and I'm sure speed is generally an improvement.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
April 6, 2018

you manually control classes by using class files.  start with the document class.