A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Preloader Animation play only once?

  1. #1
    Eternal Newbie
    Join Date
    Apr 2006
    Location
    Bitter cold Hell of the crappy NW
    Posts
    392

    Preloader Animation play only once?

    Hey Hey, I finally worked out a complex preloader complete with animations at 25, 50, 75 and 100%. I got the animations to work, I got the preloader to show up at 1% loaded and everything is marvelous.

    However, I noticed that the preloaders works perfect on slower connections, or when the file is very very large. My problem is that I have the animations check the percent loaded, so when percent == 25, animation 1 plays. When this is done on a slow connection it plays the animation over and over until percent >= 26.

    I need a way to play the animation only once when percent == 25.

    The other problem is with high speed connections or a small file size to load the preloader will load in chunks. so percent may not ever == 25, but it will == 23 then the next check it == 30, so the 25 percent animation get's skipped. If I run animation with >=25 it loops the animation playback every check of percent. Again, I only want it to play once.

    Any ideas?

    ~MoN
    If I am wrong, please just correct me and move on.. there is no need for all that pointing and laughing! ~MoN

  2. #2
    亲爱钰 slingsrat's Avatar
    Join Date
    Mar 2002
    Location
    Middle Earth
    Posts
    229
    I would add in another variable, say

    if animation >=25 && anidone == false

    and as soon as the animation starts sets the anidone variable to true. It then wont replay if you know what I mean!

  3. #3
    Eternal Newbie
    Join Date
    Apr 2006
    Location
    Bitter cold Hell of the crappy NW
    Posts
    392
    Ahh! double conditions! Genius! I should have thought of that!

    Thanks a bunch!

    ~MoN
    If I am wrong, please just correct me and move on.. there is no need for all that pointing and laughing! ~MoN

  4. #4
    the cheesy child bounceboy's Avatar
    Join Date
    Dec 2008
    Location
    Australia
    Posts
    323
    if(percent>=25&&doneanim!==0){
    movieclip_instance_name.play();
    doneanim = 0;
    }

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