dcsimg
A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Preloader issues. -.-

Hybrid View

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    6

    Preloader issues. -.-

    Well.. I'm having troubles. I have this site I'm working on for a class project.

    http://joshmoyers.com/dump/flash/test.html (I know.. Javascript needs work)

    That is how I need the page to show up. Notice that it completely skips the preloader..

    http://joshmoyers.com/dump/flash/home_page.swf

    That page is loaded in the first movie with loadMovie, but the preloader works this time..

    I used this tutorial for the preloader:
    http://www.bestflashanimationsite.com/tutorials/3/

  2. #2
    Senior Member Computer Dork's Avatar
    Join Date
    Mar 2001
    Location
    St. Louis
    Posts
    1,026
    Try making a seperate preloader movie, and loading the main inside of it. The problem is that you want the preloader to load first - not along with everything else.

  3. #3
    Junior Member
    Join Date
    May 2006
    Posts
    6
    Could you give me an example on how to do this? I tried adding a preloader to the begining of my index2.swf (main) but I was having a LOT of problems with that.. Now I've got the preloader in a seperate movie with a movie clip called 'container'

    This is my actionscript:

    totalBytes = Math.round(getBytesTotal() / 1024);
    loadedBytes = Math.round(getBytesLoaded() / 1024);
    percentDone = Math.round((loadedBytes / totalBytes) * 100);
    if (_root._framesloaded>= _root._totalframes) {
    container.loadMovie("index2.swf");
    }

    All it shows is the loading bar at 100%.. It won't load index2.swf

  4. #4
    Advance Motion Management
    Join Date
    Mar 2006
    Location
    India
    Posts
    84
    There has been a lot of problems with Preloaders in the past. At times it will show or it wont show at all, or will skip frames.
    What i will suggest you to do is to keep it simple for optimum performance.
    Go..., Create a MovieClip with a rectangle bar,(make sure that the bar inside the mclip is right on the + sign, registration point) instance name 'loadBar', and a dynamic text with instance name 'loadText'

    On frame 1 of main movie paste this code:

    bytes_loaded = Math.round(this.getBytesLoaded());
    bytes_total = Math.round(this.getBytesTotal());
    getPercent = bytes_loaded/bytes_total;
    this.loadBar._width = getPercent*100; //loadbar is instance name for bar MC
    this.loadText = Math.round(getPercent*100)+"%";//loadtext is dynamic txt for percent
    if (bytes_loaded == bytes_total) {
    this.gotoAndPlay(3);
    }


    on frame 2:
    this.gotoAndPlay(1);

    I think this was help full and simple enough, if you have further problems , donot hesitate
    Cheers
    Last edited by vinitt jaiswal; 05-10-2006 at 05:36 AM. Reason: preloader


    --
    Vini
    Its in my Blood, B+



  5. #5
    Junior Member
    Join Date
    May 2006
    Posts
    6
    Quote Originally Posted by vinitt jaiswal
    There has been a lot of problems with Preloaders in the past. At times it will show or it wont show at all, or will skip frames.
    What i will suggest you to do is to keep it simple for optimum performance.
    Go..., Create a MovieClip with a rectangle bar,(make sure that the bar inside the mclip is right on the + sign, registration point) instance name 'loadBar', and a dynamic text with instance name 'loadText'

    On frame 1 of main movie paste this code:

    bytes_loaded = Math.round(this.getBytesLoaded());
    bytes_total = Math.round(this.getBytesTotal());
    getPercent = bytes_loaded/bytes_total;
    this.loadBar._width = getPercent*100; //loadbar is instance name for bar MC
    this.loadText = Math.round(getPercent*100)+"%";//loadtext is dynamic txt for percent
    if (bytes_loaded == bytes_total) {
    this.gotoAndPlay(3);
    }


    on frame 2:
    this.gotoAndPlay(1);

    I think this was help full and simple enough, if you have further problems , donot hesitate
    Cheers

    I try this, and end up with no results...

    This is what is in Frame 3:

    _root.currMovie = "home_page";
    totalBytes = Math.round(getBytesTotal() / 1024);
    loadedBytes = Math.round(getBytesLoaded() / 1024);
    percentDone = Math.round((loadedBytes / totalBytes) * 100);
    if (_root._framesloaded>= _root._totalframes) {
    container.loadMovie(_root.currMovie+".swf");
    }

  6. #6
    Senior Member
    Join Date
    Apr 2003
    Location
    MA
    Posts
    273
    Google could solve this problem a lot easier than trying to post on a forum, but anway, just put your preloader code on your first frame of your SWF (not some stinky external file) and put the code inside an onEnterFrame() method.

    Make a cute little rectangle symbol and call it loadBar on your main timeline

    Then put this code on frame 1:

    stop();

    function onEnterFrame() {
    loadBar._xscale = 100 * _root.getBytesLoaded() / _root.getBytesTotal();
    if( _root.getBytesLoaded() >= _root.getBytesTotal() ) {
    gotoAndPlay(2);
    }
    }

    There, that really wasn't so hard, was it? The problem is that since your code is just on one frame, it only plays that frame once. onEnterFrame will loop forever until you till it to exit. Also, you don't have a stop() method, do you? Why on earth would you expect your movie to stop and wait for the preloader to finish?

  7. #7
    Junior Member
    Join Date
    May 2006
    Posts
    6
    Ended up getting it to work..

    =P

    If you wanna see the final project:

    http://joshmoyers.com/dump/flash/working/

    Get to present it tomorrow. Went a bit overboard. I was supposed to just have 5 pages with content. Ended up going with a preloader, flash inside flash, and background music as well as external links.. Hopefully it pushes for an A. =P

  8. #8
    Senior Member
    Join Date
    Apr 2003
    Location
    MA
    Posts
    273
    A) I don't hear any music
    B) Um...you should fix the hit frames for your buttons.
    C) Nice graphical style. Are the pictures yours?

  9. #9
    Advance Motion Management
    Join Date
    Mar 2006
    Location
    India
    Posts
    84
    Well i wrote a very simple preloader for you, any ways.. Cute work done
    Last edited by vinitt jaiswal; 05-11-2006 at 08:46 AM.


    --
    Vini
    Its in my Blood, B+



  10. #10
    Junior Member
    Join Date
    May 2006
    Posts
    6
    Took the music file down because of copyright issues. =P

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