A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Preloader makes my swf react differently

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    4

    Preloader makes my swf react differently

    I have an external preloader that runs before my main swf file. The main file has an enter frame listener that starts an audio file and then automatically proceeds to the second frame. This works fine if I run the swf on it's own but as soon as I run it through the preloader it just stalls on the first frame. Any idea what I'm missing?

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    try having the main file stop() by default on the first frame. Then give it an addedToStage listener so it only plays once it has been added to stage. I assume you are not adding it until preloader finishes? Sometimes when loading external swfs, it will start to play the swf in the background while its loading.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    4
    Thanks for the help. I wasn't aware of addedToStage since I'm still new to AS3. I actually WANT it to go straight to the second frame. The first frame starts some audio but I don't want people to see it. The strange thing is that it works fine without the preloader.

    Basically you play through the game and when you die you can go back to the main menu but the song plays continuously. I didn't want the song to start again because the code to play it was in the main menu frame so I added a 'ghost' frame before it. That way I don't run into that problem but the user still has access to the main menu. I'm sure there's a better way to do this, but like I said, I'm still learning and this does work (when run without the preloader). I ended up adding a button that the user can click to get to the main menu and it works now with the preloader but is a bit extraneous in that it seems like you shouldn't have to click anything. Oh well...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center