Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Participant ,
Apr 02, 2018 Apr 02, 2018

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

438
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 06, 2018 Apr 06, 2018

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

Translate
Community Expert ,
Apr 05, 2018 Apr 05, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 06, 2018 Apr 06, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2018 Apr 06, 2018

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 07, 2018 Apr 07, 2018

By manually importing classes, say in the first frame, is it possible to shrink the overhead?

Admittedly, I know little of the approach. Working with a Flash movie, I'd prefer to determine which classes have been imported and are needed as opposed to classes that may be non-essential, if such exist, and try to eliminate those.

Anyway, the answer is correct. "Manually control classes". I wasn't aware that could be done.

Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2018 Apr 07, 2018

if you put code in the first frame you'll increase your swf file more than necessary.

again, use the document class and put no code on a timeline if you want to minimize swf size.  you can use the sprite class instead of the movieclip class to further reduce file size..

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 07, 2018 Apr 07, 2018

Your suggestion makes sense. The library has about fifteen movieclips, and except for a preload segment (four frames), no timelines.

What I'm just a bit skeptical about, since I'm away from my computer for a few days, is the notion that vector graphics as movieclips could be further optimized by converting the objects to sprites. I thought most of the overhead from vectors came from the number of nodes and Bezier curves.

It will be interesting to see how much the shrinkage is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2018 Apr 07, 2018

i don't think it would be worthwhile to change all your movieclips to sprites unless the file size is breaking something (eg, max file size for an ad.) 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 07, 2018 Apr 07, 2018
LATEST

No, but if you want to lose weight, why not lose all of it? I have to see what will work. It's hard to comment otherwise. Getting rid of excess classes should be my first priority. At the very least I will learn how it's done. I may also find that the movie is optimized and manually importing classes will only marginally shrink the size.

Still, worth giving it a whirl. Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines