A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: One Time Events

  1. #1
    Member
    Join Date
    May 2001
    Posts
    69

    One Time Events

    Hi,
    I'm currently using a progress bar to indicate how much of my movie is loaded. When I reach a certain percentage loaded, I want the movie to start automatically, so I have an "if" statement that starts the movie playing when the percentage loaded is greater than 10%.

    Everything works fine on this. However, I also have a Pause button for my movie that allows the user to stop the movie. So what's happening is that until my movie completes loading, it continues to loop through the "if" statement. Each time telling my movie to start playing. Because of this, the Pause feature will not work while the movie is loading, because as soon as the user hits Pause, then the if statement executes and tells it to start playing again.

    What I really need is a "when" statement, something that executes the script the first time the condition occurs and doesn't do it anymore after that. Is there such a thing? Or what's an easy way to do it. Below is one frame of the preloader (note there are other frames not shown).

    Thanks,
    Maria

    iBytesTotal = _root.CurrentSection.getBytesTotal();
    iBytesLoaded = _root.CurrentSection.getBytesLoaded();
    iBytes = Math.round((iBytesLoaded/iBytesTotal)*100);
    if (iBytes>10) {
    //This automatically starts playing the movie when 10% is loaded.
    clearInterval(_global.SloMointervalID);
    _root.SectionControls.gotoAndStop("Playing");
    tellTarget ("_root.CurrentSection") {
    play();
    CurrentPara.Play();
    }
    _root.SloMoControl.gotoAndStop("Playing");
    }
    setProperty("pBar", _xscale, iBytes);
    sStatus=iBytes add "% Loaded";

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    why don't you make the pause button appear only when 100% is reached?
    else, you could set a variable via the pause button. and though keeping the preloading, make the movie stop instead of play when 10% is reached && that var is true.
    gparis

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