1
votes

first of all I want to tell that I know there are hundreds of similar questions, but most of them are for projects/games which are built for "on stage development".

I'm using pure as3 approach to develop games. I don't use*main timeline and my project has only 1 frame*.

On my main class's constructor, I only add preloader to the stage.

But still my preloader is seen only when the game is completely loaded.

My question is simple: "Why?" and "How can I fix this?"

-When I try to "uncheck" export as3 on frame 1, flash gives error.(because some of my classes are imported on the main class.)

-Even if I create second frame and put every contents of the game except preloader, the problem is still unsolved.

Thank you very much for spending your time to read this and help me.

-Ozan

1

1 Answers

2
votes

To make the preloader, you either need two SWFs or at least two frames. Even FlashDevelop has an ability to use two frames, for this the directive [frame factoryClass="ClassName"] is used in main AS file before public class Main. This is the core limitation of Flash player, that is, it first loads the first frame, and only then it can display that frame. Since you've said you have only one frame, then your game has to be loaded 100% (1/1 frames) before you will see a thing.

There's more - if you are referencing a certain class on frame 1 via its class name, the class with all its dependencies is embedded in the same frame (the first), so you're screwed again. To bypass this, execute stepos 10 through 14 from this instruction to set the frame for classes to be 2 (replace 10 for 2 while executing the instruction), clear "export in the first frame" for all classes except your preloader, and add an instance of game's main class to keyframe 2. Then in preloader code perform proper cleanup and do gotoAndStop(2).