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

It is too long time to load swc files (only Android)

Explorer ,
Mar 13, 2019 Mar 13, 2019

Copy link to clipboard

Copied

Hi. I receive old AIR app. I hope to work app in Android OS.This app works without problems in Windows, Mac and iOS.But app start very slowly only Android.

This is test result table.

HardwareOSStart-up time
Apple iPad2iOS 95sec
Apple iPad 6th gen.iOS 123sec
Amazon Kindle Fire HD7 (2nd gen/2012)FireOS (based on Android 4.0.2)26sec
Asus Nexus 7Android OS 4.423sec
Huawei MadiaPad T3Android OS 7.021sec

Oh,No.......I feel air compiler convert to slow code for Android.I research app and change publish settings.I have not solved this problem yet. Direct mode did not solve

This app declare many class from many swc files(500KB-5MB/file * 50 files) in main class's constructer.

var class1:(className in swc file)

var class2: (className in swc file)

..... 350 lines

When I reduced class, app start quickly.But most classes are required.I’m thinking of making loader and loading bar. Does anyone have a better idea?

TOPICS
Development

Views

1.4K

Translate

Translate

Report

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

Engaged , Mar 13, 2019 Mar 13, 2019

We've had a similar experience with some apps on Android, and especially if you're doing a lot in your constructor or have a lot of items in your swc libraries, you can sometimes get much quicker loading times if you add a simple preloader to the app.

Since we use FlashDevelop we use a Frame metatag to add a preloader frame before the Main document class like this:

[Frame(factoryClass = "Preloader")]

And set up Preloader.as with preloading code as if it was for the web instead of an app (we use som

...

Votes

Translate

Translate
Advocate ,
Mar 13, 2019 Mar 13, 2019

Copy link to clipboard

Copied

You are the author of the .swc files? You can publish them to .swf instead and then create a loading bar, as you said.

The reason why it's faster on iOS is probably because Air compiles the AS3 code natively to iOS, so all the .swc files are parsed and translated at compilation time. On Android, this is probably happening on runtime, depending on how you use them.

Votes

Translate

Translate

Report

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
Explorer ,
Mar 13, 2019 Mar 13, 2019

Copy link to clipboard

Copied

I'm maintainer and developer left company. I don't know this app in detail. Perhaps I have most fla files and I can generate swc/swf file.

Wow, I understand why the speed is fast. Air compiler is great.

Votes

Translate

Translate

Report

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
Advocate ,
Mar 13, 2019 Mar 13, 2019

Copy link to clipboard

Copied

SWC are compiled with your build and not loaded at runtime. The reason it's slow comes from something else.

Votes

Translate

Translate

Report

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
Explorer ,
Mar 13, 2019 Mar 13, 2019

Copy link to clipboard

Copied

Umm....I don't declare valiables(classes) and Android start this app in 3 sec.

It may be so. In fact, it gets faster as I delete the core swc files(But there is only 5MB). I guess that variable declaration is this problem's core. For example, variable has been duplicated.

But There is not much time to fix core swc files.

Votes

Translate

Translate

Report

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
Engaged ,
Mar 13, 2019 Mar 13, 2019

Copy link to clipboard

Copied

We've had a similar experience with some apps on Android, and especially if you're doing a lot in your constructor or have a lot of items in your swc libraries, you can sometimes get much quicker loading times if you add a simple preloader to the app.

Since we use FlashDevelop we use a Frame metatag to add a preloader frame before the Main document class like this:

[Frame(factoryClass = "Preloader")]

And set up Preloader.as with preloading code as if it was for the web instead of an app (we use something similar to FlashDevelop's web preload template where Preloader extends MovieClip and then checking if currentFrame == totalFrames on enter frame before setting up the Main document class).  You don't really need to bother with loading bars or anything, as the app doesn't have much time to actually display anything the Preloader does.

This gives us much quicker loading times on Android builds -- something that would take 15-20 seconds to load on an ancient Kindle or slow Android device only takes 2 or 3 seconds for us after adding a Preloader.  Seems bizarre that it makes such a big difference on Android, but it does give a nice improvement to startup time if you're having trouble with an app.

Votes

Translate

Translate

Report

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
Explorer ,
Mar 15, 2019 Mar 15, 2019

Copy link to clipboard

Copied

Thank you for information.

I don't know in detail about metadata tag and study it.

Perhaps, If I use Flash IDE about Publishing, I can't use metadeta tag?

(ASC 2.0 basically ignores metadata.It needs an option to use.)

flash - Does ASC 2.0 recognize [Frame] metadata tags (ex: for Preloader factoryClass)? - Stack Overf... 

Votes

Translate

Translate

Report

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
Enthusiast ,
Mar 16, 2019 Mar 16, 2019

Copy link to clipboard

Copied

see
https://discuss.as3lang.org/t/error-1502-a-script-has-executed-for-longer-than/1540

for the usage of the compiler option -frames
which allow you to split the load over multiple frames

you can also combine it with a preloader if you want

simply put a SWF file is a stream of bytes, but there is so much that can be parsed/verified/etc. over 1 frame

the metadata for preloading come from the Flex framework, as Flex apps were quite heavy

see for simple usage/implementation

Using Metadata Frame for a Preloader at Jozef Chúťka's blog

in short, something like [Frame(factoryClass="foobar.MyPreloader")]
load first the MyPreloader class and not your main class
which allow you to test the bytesLoaded/bytesTotal of the whole SWF
before initialising your main class


see here
Preloaders in AS3 » BIT-101 Blog

for a more details into how preloader works

Votes

Translate

Translate

Report

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
Explorer ,
Mar 20, 2019 Mar 20, 2019

Copy link to clipboard

Copied

Sorry, I study various things but decide to give up.

"We" know little about Flex and CLI Compiler and mxml.

We can't afford to know because It's 2019, not 2009.

I make "old-school style Preloader".

Thank you everyone.

Votes

Translate

Translate

Report

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
Enthusiast ,
Mar 20, 2019 Mar 20, 2019

Copy link to clipboard

Copied

LATEST

when you compile code and build apps
one day or another you will have to learn a bit of the command-line and the compiler options

whatever the year ...

Votes

Translate

Translate

Report

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