I have currently programmed my first game, but now I have a problem.
It has a size of 100 KB and I thought it would be great to have a preloader for that.
But the flash movie gets loaded before the preloader starts which takes the idea out of the preloader.
I have just two frames on my main timeline with the first empty and the code for the preloader and my second frame contains an empty movie clip with the AS that attaches the movie clips from the library.
Can anybody help me? Or do I not really need a preloader for a 100 KB big game? Because with DSL it loads within a few seconds.
The problem is, when you export symbols, the movie loads all of the symbols before it starts running the actionscript. What you need to do is untick 'export in frame 1' for each symbol. This will load the movie clip when they are found on the stage but attachMovie() wont work on those symbols until they have already been encountered on stage. So you also need to create an extra frame after your preloader and before your actual game, and drag all your symbols on that frame. I cant quite remember if you have to drag the preloader on stage rather than adding it dynamically, just try and see if dynamically adding it works.
Yeah, it basically works, but now the preloader only starts from 97%. It still loads a lot at the first frame.
Oh and I am adding not ALL of the movie clips dynamically. I also have one big movie clip with a lot of frames and other movie clips in it. So there isn't the option for exporting in first frame to tick off at a lot of movie clips.
And when you right-click and say "Rewind" you get to an empty frame. How is it possible to delete or remove the right-click menu with all that options to move between frames, because I often saw that at some games only two things are in the right-click menu.
You should be able to tick 'Export for Actionscript' on all of your movie clips including the ones that are dragged on stage, and untick 'Export in frame 1' for them. As for the rewind, I don't really get it, I don't get such an option when I right click.
Oh and I am adding not ALL of the movie clips dynamically. I also have one big movie clip with a lot of frames and other movie clips in it. So there isn't the option for exporting in first frame to tick off at a lot of movie clips.
If you actually have the movie clip or movie clips nested in the movie clip on the stage you do not need to put in the export in frame 1. The whole reason you have the export in frame 1 is if you are adding items dynamically. If you do not have the object on the stage or exported in frame 1 the .swf that is compiled does not include the object.
now it is working. I just ticked everywhere "Export for Actionscript" and then i was able to untick "Export in frame 1" (pretty much work with 130 Symbols!). And then I made a symbol named dummy and dragged all of the symbols in it (again a lot to do with so much symbols) and placed it on the second frame. And when the game gets loaded I just skip to the third frame where the actual game is.
@driejen: When your movie has more than one frame on the main-timeline and you export it and right-click on the flash movie it says something like "Rewind", "Forward","Back" and so on.
I removed this by adding this code to the first frame:
myMenu = new ContextMenu(); myMenu.hideBuiltInItems(); _root.menu = myMenu;
hi! I don't quite understand the part where you load all your symbols onto the second frame. During the playback, wouldn't you see a frame where they all appear? That would ruin the flash show right? Do you place them off the stage? Also when you say "untick 'export in frame 1' for each symbol" does that mean buttons, movieclips, and graphics also? Thanks!
The first frame is stopped and contains the preloader, once everything is loaded the movie moves on to the third frame where the rest of the actionsript lies. The second frame is never shown and its only purpose is to hold the symbols.
All symbols, buttons, movieclips and graphics alike, so long as you need them to be dynamically added to the stage, needs to be exported, but not to frame one. The reason for this is, if you export to frame one, the preloader will load up only after all of your symbols are loaded, rendering the preloader useless.
By placing all your symbols on the second frame, the swf will look at the first frame and see that it needs to load the preloader symbol, hence the preloader starts working. The swf then looks at your second frame and sees that it needs to load all the symbols you placed in there, as the symbols load the preloader bar fills up.
You have to stop the movie at frame 3, otherwise it will loop back to the preloader, then skip to frame 3 again. Each loop it does may make the screen flicker and also reset frame 3. So all variables and event listeners will be wiped clean. Its better to keep the rest of your code in frame 3.
I don't know exactly what that error implies. But I'm guessing you either haven't imported the necessary properties on the class files, or you haven't converted your bitmaps to symbols.