A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: conditional preload

  1. #1
    Member
    Join Date
    Jun 2004
    Posts
    32

    conditional preload

    Hey guys...i am trying to put together an interesting preloader.

    I have a movieclip that is 8 frames long. All I want to do is make it play for as long as it takes for the rest of my entire movie takes to load.

    what I really want is for it to reach its last frame at about 97% of the way for the entire movie load time. The movie clip doesnt even HAVE to stay at 8 frames, it can be more or less.

    I dont know much about actionscripting and I've tried a few tutorials but not many of them that i found address this specifically enough for me to learn it on my own any help would be appreciated.

    I know how to make it play if all bytes are not loaded but i dont know how to stop it from playing all the way through and make it play in sync with the loader. Any suggestions?
    thanks
    D

  2. #2
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Do you mean that you have an animation that has 8 frames that you'd like to play while you load? If so, I've found that the best way to do this is to have two seperate movies.

    You have the first swf (the loader) with the animation in it. On the first frame, you load the second MC into a container with _visible = false. Then you run your normal checks for loading but the animation should play.

    If you want actual code, just lemme know.

  3. #3
    Member
    Join Date
    Jun 2004
    Posts
    32

    hey..yeah

    Hey....

    Yes, I have an animation with 8 frames that I'd like to play while my entire movie loads. I don't want it to reach the end of the 8 frames until the movie has loaded to about 97% though.

    It would just be an animation instead of a normal preloader bar, I guess.

    I think I understand what you're saying but I am not sure if thats the solution, so any code help would definitely be appreciated.
    Thank you!
    D

  4. #4
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    You have 2 swfs: main.swf, loader.swf.

    Loader.swf, frame 1:
    PHP Code:
    loadMovieNum("main.swf",1);
    _root.onEnterFrame = function(){
    loaded _level1.getBytesLoaded();
    total _level1.getBytesTotal();
    percent int((loaded/total)*100));
    if(
    percent 99){
    _level1.gotoAndPlay(2);
    }

    Main.swf, frame 1:
    PHP Code:
    stop(); 
    Also, have the first frame blank. That should do it.

  5. #5
    Member
    Join Date
    Jun 2004
    Posts
    32
    thanks...

    do you mean to have
    main.swf in frame 2?

    also, the way I read this, it looks like loader.swf will just loop until all bytes are loaded - is that correct?

    I'll try giving it a shot

  6. #6
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Sorry, loader.swf should have a stop action in frame 1.

    Since your animation is an MC in the loader.swf, it should look until the condition is met. For the main.swf, you want the first frame blank with a stop action, so that when you load it, you don't see it until it's finished loading.

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