dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: problems with preloader

  1. #1

    problems with preloader

    hi there

    is there anything wrong with this preloader ?

    on frame 1:
    Code:
    if (this.getBytesLoaded()==this.getBytesTotal()) {
       gotoAndPlay("Scene 1", 1);
    } else {
       percentage = Math.round((getBytesLoaded()/getBytesTotal())*100);
       status.text=percentage+"%";
    }
    on frame 2:
    Code:
    gotoAndPlay (1);
    i've been building a random answer fortune telling game for the past few weeks for a clients [can't post it up unfortunately] and all has been running smmothly until it was time to add a preloader scene and add the preloader. i added the code above along with some graphics and some of the functionality within the actual game was affected. certain animations wouldn't play and some buttons stopped working even though i had not changed the code within the game. all i'd done was add a preloader. i have no idea why this is happening, and when i remove the preloader scene - it all starts working again.

    has anyone else experienced this or is there something wrong with my preloader.

    any help would be much appreciated as i'm ripping my hair out here...might not have any left soon.

    cheers

    e

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Try changing:

    if (this.getBytesLoaded()==this.getBytesTotal()) {

    To:

    if (_root.getBytesLoaded()==_root.getBytesTotal()) {

    Using this works good for a preloader that is used inside an swf that will in turn be loaded as an external. Use _root for the main movie preloader.

  3. #3
    thanks

    but i've just this minute managed to fix it by placing the preloader on the 1st two frames of the main game rather than in a separate scene.

    weird but true.

    thanks for your time.

    e

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Yes, the 'this' code will work if it's all in the same scene.

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