dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: start/stop w/one button?

Hybrid View

  1. #1
    Member
    Join Date
    May 2001
    Posts
    40

    start/stop w/one button?

    hey ive got a video as a movie clip that plays when i click a button, but i want to be able to click that same button again to make it stop but cant seem to pull this off.

    here's what i have so far:

    jerry_mc.stop();

    jerry_btn.onRelease = function() {
    jerry_mc.play();

    }

    this works to play it, but obviously doesnt stop it.
    any advice?
    thanks for any help.
    jon

  2. #2
    Senior Member the_protectot's Avatar
    Join Date
    Jul 2003
    Posts
    401

    try this

    code:

    jerry_mc.stop();
    toggle=1;

    jerry_btn.onRelease = function() {
    if(toggle == 1)
    jerry_mc.play();
    toggle=0;
    }else if (toggle == 0){
    jerry_mc.stop();
    toggle = 1;
    }
    }


  3. #3
    Member
    Join Date
    May 2001
    Posts
    40
    thanks.
    but now im getting this back:

    Scene=Scene 1, Layer=jerry, Frame=1: Line 8: ';' expected
    }else if (toggle == 0) {

    Scene=Scene 1, Layer=jerry, Frame=1: Line 12: Unexpected '}' encountered
    }


    and the MC isnt stopped when i play the movie it just starts right up.

  4. #4
    Senior Member the_protectot's Avatar
    Join Date
    Jul 2003
    Posts
    401
    jerry_mc.stop();
    toggle=1;

    jerry_btn.onRelease = function() {
    if(toggle == 1){
    jerry_mc.play();
    toggle=0;
    }else if (toggle == 0){
    jerry_mc.stop();
    toggle = 1;
    }
    }

    sorry missed a brace..

    oh and in the button script, you might have to refer to "toggle" as "_root.jerry_mc.toggle"

    Where is this script located?

  5. #5
    Member
    Join Date
    May 2001
    Posts
    40
    thanks so much. thats perfect.
    you saved the day.

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