load screen question + irritating button

7 posts

Flag Post

Okee, I’ve got the majority of my game figured out except for a couple irritating points.

The first is my loading screen. I had it working just fine with a filling bar and a byte count, just dandy, but now my game loads in an unintended order when I try to simulate download… So instead of my loading screen popping up with my load bar/byte count at the beginning with the first couple of percents finished(the load screen itself) It stays blank for a while then pops up at 70% finished(having loaded other scenes first).

The way I have my .fla organized it like this:

scene 1: loading
frame 1: load bar, byte counter(two dynamic texts) and a little fade-in / fade-out ‘loading’ text.
frame 5: the background from frame one and a start button(works fine, more on buttons in a bit)

scene 2:menu screens.
frame 1: logo, automatically forwards when done to…
frame 10: Main menu, play button, instructions button, credits button.
frames 20,30,40,50, etc.: instructions and credit frames.

scene 3: game itself
frame 1: the actual game code, it’s blank, all sprites, backgrounds, text boxes and otherwise are added by the code when you run the game.
frame 5: a currently nonfuctional Game Over screen.

I know this is all probably messy, well, you should see my code XD But it’s working just fine except for the load bar, so the bottom line is: how can I determine what gets loaded first? The scenes are names almost exactly as stated above, so I was wondering if maybe it loaded alphabetically? Is there a command for forced loading orders? please help, I’m going to reply to this thread with my next question to keep them seperate…

Flag Post

bah, my interwebs are screwing up, I’ll ask my other question later since I think I quite suddenly figured it out, but help on this is still greatly appreciated :)

Flag Post

You need to turn off ‘export in first frame’ for all your symbols and bitmaps.
The option is accessible by opening the symbol’s properties or linkage dialogue boxes. It’s only selectable if you’ve selected ‘export for actionscript’.
Once you’ve done that, you’ll need to put a copy of the symbol on some other timeline frame (which you don’t need to ever display).

Flag Post

thanks lysis, It managed to fix most of the problem just fine.

Now the button… I have a game over screen in the same scene of the game itself, but the button to go back to the menu won’t work. I put a trace line in the menu frame and it says it goes to the menu, but it’s not appearing… Do I need to go into the onRelease function and remove all the existing movieClips? Also, what’s the movieClip._? for depth? Is there a good for() loop that can go through all the layers and remove whatever’s there?

Flag Post

You’ll need to delete any movieclips that you drew with code and you want to get rid of. If you’ve covered the entire screen you won’t be able to see any stuff (like a menu) that you drew in the frame.

There isn’t a movieclip variable for the depth, but you can swap depths with another movieclip (or an empty depth) using the swapDepths method.

You can loop through mcs and delete them. How you do it depends on how you’re set up.
I’ve used this in a generic clear screen routine:

for(i in this){
if (typeof(eval(i))==“movieclip”){

I wouldn’t use that in-game, though.

Flag Post

that actually works great for me because I have everything set up in an array for the most part.

so exactly how does the for(i in this) line work? I know the basic for loops [for (i = x; i < y; i++)] but this is new to me and I imagine the “in” command has many uses not yet discovered by me.

Flag Post

I’m not familiar with AS3 specifically, but rather than let this question just kinda float here I’ll say that in most languages, the way the for( i in whatever) construct works is basically that whatever is an array, and every time through the for loop i becomes one member of the array.

The following pseudo-code, for instance, would print out the first six prime numbers:

int[] foo = {2, 3, 5, 7, 11, 13}; //make foo an array of primes
for(int element in foo){
    print(element + " is prime!");

Edit: Now that I’ve looked into it, Flash doesn’t actually have a for…in construct. Instead, you use array.forEach(function), which passes every element of array as the argument to function.