A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Preloader problem! (MX 2004)

  1. #1
    Junior Member
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    10

    Preloader problem! (MX 2004)

    Hey!


    I don't really know if this is possible? Here goes; I have a site right.. as it is today the whole site is preloaded from start; Info, Contact and the heavy part, the Portfolio.

    You can have a look at; www.paperino.se (it's in Swedish)

    To the question; Is it possible to first load the site so you only can access the Info (Om oss) & Contact (Kontakt) part while the Portfolio part is getting loaded in the background?

    I know that one solution is to make it into two files instead... the portfolio could be named eg. porfolio.swf and have a preloader function of its own. The point is that I would prefer to keep it as one file - with the Portfolio part of the file being preloaded separately in the background.

    I would really appreciate any help!

    Cheers, Bateman
    Last edited by Mr_Bateman; 05-07-2004 at 11:24 PM.

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Location
    Malibu
    Posts
    251
    It is possible to preload only part of the site if you insist on keeping it all in one file. To do this you would have to have you portfolio section come after everything else on the timeline. You would also need to make sure that nothing in the portfolio section is attached dynamically - because that stuff always loads before anything else (including your preloader).

    As far as having a preloader for this operation goes, the easiest way would be to use the old _framesloaded >= frameNum (where frameNum is one number less than the first frame of the portfolio). If you want to use getBytesLoaded() for you preloader the easiest way is to generate a size report and use that to figure out the size of the movie without the preloader section.
    www.electricbluemonkey.com

  3. #3
    Junior Member
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    10
    Thanks man!

    I'll try to work something out with the framesloaded... you wouldn't know about a good tutorial in this issue? I'm still quite new to flash but i'm eager to learn!

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Location
    Malibu
    Posts
    251
    No, I don't know of a tutorial, but this might help:

    code:

    // put this on the first frame of your movie
    // set this equal to the first frame of your portfolio
    // (if you have multiple scenes in you movie add up all the frames
    // in every scene that comes before the portfolio)
    frameNum = XX;
    // this will prevent the movie from playing until all the frames
    // up to frameNum have loaded
    this.onEnterFrame = function(){
    if (_framesloaded >= frameNum) {
    play();
    // this function will delete itself
    // when the frames have loaded
    delete this.onEnterFrame;
    } else {
    stop();
    }
    }

    www.electricbluemonkey.com

  5. #5
    Junior Member
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    10
    Thanks heaps man!

    I'll try this! But this will only load the frames up to the "portfolio-part" of the scene right? (The page is only one scene built up by MC's btw). Should I use the same code for the frame just before the portfolio part? So that when the first part of the movie has been loaded and you get access to the menu... you can skim thru the other parts of the site whilst the portfolio section starts preloading in the backgound.

    hmm.. I just realized that there might be a problem with one part preloading and in the same time being able to go thru some parts of the site... (?)

    I'm sorry for all these newb questions!

  6. #6
    Senior Member
    Join Date
    Nov 2000
    Location
    Malibu
    Posts
    251
    You should only need to use this once. After the initial frames have loaded the entire movie will still be loading so you don't need another preloader for the portfolio. However, you may want to make the link to the portfolio section invisible until it has loaded.

    Here is a sample that would accomplish this:

    code:

    // put this on the first frame of your movie
    // set this equal to the first frame of your portfolio
    // (if you have multiple scenes in you movie add up all the frames
    // in every scene that comes before the portfolio)
    frameNum = XX;
    // this will prevent the movie from playing until all the frames
    // up to frameNum have loaded
    this.onEnterFrame = function(){
    if (_framesloaded >= frameNum) {
    play();
    } else if (_framesloaded == _totalframes){
    // change "portfolioButton" to the instance name of your
    // actual portfolio button
    // make the button visible
    portfolioButton._visible = 1;
    // enable the button
    portfolioButton.enabled = 1;
    } else {
    stop();
    }
    }
    // Also, on the frame where the portfolio button first appears
    // put this code:
    // this will make the button invisible as well as disable it
    portfolioButton._visible = 0;
    portfolioButton.enabled = 0;



    www.electricbluemonkey.com

  7. #7
    Junior Member
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    10
    Too good man!!

    I'll work with your code and see how it turns out! Thanks once again, i'll keep you posted!

    regs, Bateman

  8. #8
    Junior Member
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    10
    I can't get it to work??

    I put the code in the first frame as you said but it's like the movie doesn't realize it should only load the first frames and then play... it tries to download the whole file before showing it - which results in a blank screen until the SWF file has been loaded?

    Hmm... I must have done something wrong!? If I stripped the file down a bit do you think you would have time to have a look at it?

    Cool function with the enable thing on the button btw... I think i'm gonna use _alpha function instead of _invisible though.

    anyways... send me your e-mail on info@designlab.se if you're ok with having a look at the file!

    cheers, Bateman

  9. #9
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Do you have elements in your portfolio section with Linkage set to export on the first frame?

  10. #10
    Junior Member
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    10
    Hi!

    No, the portfolio is a "stand alone" part of the main scene... if that's what you mean? ie. no parts of the portfolio is linked or mentioned in the source/scene except in the "portfolio button".

    haha... don't know if i answered your question?

  11. #11
    Junior Member
    Join Date
    May 2004
    Location
    Sydney, Australia
    Posts
    10
    Still stuck!

    Any suggestions??

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