A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: how to activate a load checking function?

  1. #1
    Member
    Join Date
    Nov 2001
    Posts
    30

    how to activate a load checking function?

    i'm trying to load a movie within a movie from a button? how do i include a locad checking function that checks that the 1st movie is loaded before loading the other?

  2. #2
    Senior Member
    Join Date
    Feb 2003
    Posts
    825
    so you don't want movie 2 to load until movie 1 has completely loaded? the easiest way to do that is to not make the button appear or not make it clickable until the last frame of movie 1.

    i'm sure you could so it with action script, but you really don't need to use it in this case, and it would actually make things more difficult b/c you would need to script that checks to see if movie 1 has competely loaded, then when it has, then the button would appear...probalby an IF statement that would loop...makes more sense to just put the button on the last frame of the movie.

    I know that knowing AS is cool, but it's not always the answer to everything

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Basically...
    code:

    this.onEnterFrame = function(){
    if(_level1.getBytesLoaded() >= _level1.getBytesTotal()){
    //load second movie...
    //Or show your button to load the second movie...
    //Or whatever...
    delete this.onEnterFrame();
    } else {
    //You could display a loading message or whatever else here...
    //Till the movie is fully loaded...
    }
    };


  4. #4
    Member
    Join Date
    Nov 2001
    Posts
    30
    Thank you oldnewbie.

    What i have is a MC (which resides inside a container MC in a swf on level 1 of my main movie) with the following script in it:

    code:

    on (release) {
    loadMovieNum("projects_nav.swf", _root);
    this.onEnterFrame = function(){
    if(_level1.getBytesLoaded() >= _level1.getBytesTotal()){
    //load second movie...
    loadMovie("sentosa.swf", _root.contents);


    }
    };
    }




    so i have now managed (with your help!) to load the movie (projects_nav.swf) and then get sentosa.swf to load within that but what i am NOT getting is all this loading on level 1 on the main movie. instead it's all loading inside the containerMC. i know this is pretty simple but I can't seem to get it right. the error is in the loadMovieNum bit right? it shouldn't be _root, but what should it be?

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    loadMovieNum("projects_nav.swf", 1);

  6. #6
    Member
    Join Date
    Nov 2001
    Posts
    30
    thanks again oldnewbie!

    i'm sorry, i know i have lots of questions. there is still a lot i'm trying to figure out. is the above script right? cos now the 2nd movie (sentosa.swf) is not loading within the containerMC (which is called "contents"). i'm so confused!!

  7. #7
    Member
    Join Date
    Nov 2001
    Posts
    30
    can anyone help??

    sorry, don't mean to be a bother but am trying to figure this out pretty urgently.

    code:

    on (release) {
    loadMovieNum("projects_nav.swf", _root);
    this.onEnterFrame = function(){
    if(_level1.getBytesLoaded() >= _level1.getBytesTotal()){
    //load second movie into "contents" (a containerMC in projects_nav.swf)...
    loadMovie("sentosa.swf", _level1.contents);


    }
    };
    }



    so basically, everything after loadMovieNum doesn't quite seem to be working. any ideas???

  8. #8
    Senior Member
    Join Date
    Feb 2003
    Posts
    825
    had you taken my advice, you wouldn't be going though all this trouble right now.

    my suggestion would do exactly what you want, and wouldn't be give you/oldnewbie all this trouble...

  9. #9
    Member
    Join Date
    Nov 2001
    Posts
    30
    thanks iguanagirl32 but not using actionscript isn't really feasible in this case because my container Movie Clip has to load different things at different times from different buttons.

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Why don't you just attach all the relevant .flas, zipped up and in a MX only format, so I can stop theoritically trying to solve this problem, and have the actual setup in front of me?

  11. #11
    Member
    Join Date
    Nov 2001
    Posts
    30
    ok, here's the zip file. thanks in advance for your attention to this, i'm very grateful

    start from home.swf > click on awards.
    from the first pic on the right side (next to the 1st listing "Cityscape Awards....."), I want to be able to click the pic and then load projects_nav.swf. then sentosa.swf must immediately also load into an empty movie clip called "contents" which is in projects_nav.swf.
    Attached Files Attached Files

  12. #12
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Just when I thought I could go grab a bite!

    Think I will anyways...

  13. #13
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Ok! You've got a few options here... I got it working, but haven't checked (in this complicated navigation...) if all your different preloaders would in fact work... I just concentrated in solving your other problem...

    In this case, my proposed suggestion (in which there was a typo! - it should be delete this.onEnterFrame; and not delete this.onEnterFrame(); ), won't really work, because you're loading all the different movies on the same level...
    You're loading awards_nav on level 1, and so when you load your projects_nav also on level 1, you're actually clearing out the awards_nav movie which holds the script to load your sentosa.swf, before it actually has time to load it up. If you loaded it on level 2, then this script (along with the other correction posted after it...) would work...
    code:
    on (release) {
    loadMovieNum("projects_nav.swf", 2);
    this.onEnterFrame = function() {
    if (_level2.getBytesLoaded()>=_level2.getBytesTotal() ) {
    // load Movie Z into container movie clip in Movie Y...
    loadMovie("sentosa.swf", _level2.contents);
    delete this.onEnterFrame;
    }
    };
    }



    But for the above to work, you also need to make the contents container clip present on the first frame of your projects_nav.swf and not only on frame 25 as you had it. You cannot load a movie in a container clip that doesn't exist on stage at the time of the call of the loadMovie action!

    But for an easier solution, I'd simply scrap most of the above script and just keep the first part...
    code:
    on (release) {
    loadMovieNum("projects_nav.swf", 1);
    }


    Then, as stated above make sure your "contents" clip is present from the first frame of your "projects_nav.swf", and simply add the loading call on that first frame... within "projects_nav.swf", with the following line...

    loadMovie("sentosa.swf", this.contents);

    Hope it works for you! If not post again.

  14. #14
    Member
    Join Date
    Nov 2001
    Posts
    30
    thank u soooooooooo much oldnewbie!!!
    i think i've finally gotten it to work.

  15. #15
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    NP!

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