A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Creating a "Play All" function for interactive cd

Hybrid View

  1. #1
    Senior Member
    Join Date
    Jul 2002
    Posts
    150

    Creating a "Play All" function for interactive cd

    I'm creating an interactive cd with traditional navigation and a "play all" feature. I was planning on doing playAll==true; within my "play all" nav and having the movie clips look for it within the timeline by using if statements. Is there a better/correct way to do this?

  2. #2
    Get Squared Away.
    Join Date
    Feb 2000
    Location
    Allentown, PA
    Posts
    543
    I think you're on the right track...you can create a boolean value to check for, and if it's true, run a function. So if you have 4 different sections on one timeline (section 1, section 2, section 3, section 4)...and a user clicks "section 1"...you could have code on that frame that says:

    Code:
    if(playAll){
         //interval that waits a predermined amount of time, then plays then advances the timeline
         startTimer(this);
    }else{
         stop();
    }
    and your startTimer function could look something like this:

    Code:
    function startTimer(target:MovieClip){
         var ref = target;
         var myInterval:Number = setInterval(myTimer, 3000, ref);
    }
    
    function myTimer(target:MovieClip){
         //advance timline
         target.play();
    }
    so if somebody presses "play all", it will run your startTimer function which will advance through the sections every 3 seconds...

    Hope that gets you started.

    Josiah

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