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

Prevent MovieClips from loading

Guest
May 28, 2013 May 28, 2013

Hello all,

When I test my FLA (a video game), for some reason all of my MovieClips classes will load in the background.  They are not placed on the stage, all of them are in the library.  The way I know that they load is that I placed some trace statements in each of their classes.  When I test, trace("level one has loaded") will show in the output.  So that is how I know they are loading.

I do not want them to load when the game begins, I want them to load when they are placed on the stage.  The reason is that I feel it is too expensive and also because I am using timers which I want to begin only when they are on stage. 

I have played around with ENTER_FRAME and currently have the movieclips triggered to enter the stage after a mouse event but they are still loading.  How can I prevent them from loading until they are needed?

By the way, I have played around with the publish settings like "Automatically declare stage instances" but so far no avail.  There has to be something I'm missing.  Also, this is happening with both timeline code and external classes.

I am running CS6 Web Premium on WIndows 7.

TOPICS
ActionScript
496
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 ,
May 28, 2013 May 28, 2013

the classes will load (but no instances will be created) in the frame you indicate for export classes in your publish settings and in your library.

do you have your trace in the class constructor or elsewhere?

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
Guest
May 28, 2013 May 28, 2013

Elsewhere.  My trace statements are outside of the constructor.  However, the constructor function calls an init() function and there are trace statements in the init() function. 

I also have trace statements deeper within the classes that are still being called.  It seems so long as they are within a hierarchy that goes back to the constructor function, they will load when the FLA is tested.

Exactly what you said is happening, loading classes but not instances.  As for the timer's, in the end, the event handling worked out (quite simply) by just starting the timer when a button is clicked.  In my case when the level_one selection is clicked level1.timerVar.start(); So while I can't toggle a class, I can toggle a timer.  So that will work for now. 

I am still worried that by having these classes load it will overburden a hand held device.  I am really hoping the solution does not include Loader (for Loading assets and there classes).  Based on the little I know, there are porting issues with iOS and more importantly exceptions will be thrown for addChild(), removeChild() when using Loader.  I really depend on those methods instead of waiting around for garbage collection.

There has to be a way to prevent these classes from running in the background.  My games involve a lot of code and manipulation of assets with AS3 code via arrays, timers and other things which, when bundled together, could overburden or potentially crash a handheld device.  Too expensive.

I really want to prevent the classes from loading, but how?

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 ,
May 28, 2013 May 28, 2013

you're creating instances even though you think you are not.

there's no way to determine via a forum where that is happening but it could occur in any class (using code) or in the ide (for any class that extends the DisplayObject 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
Guest
May 28, 2013 May 28, 2013
LATEST

I'll tinker around and post a solution if I find one.

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