A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Controling a movie clip with seperate buttons

  1. #1
    Member
    Join Date
    Aug 2002
    Posts
    57
    I have three buttons, I also have a fourth main movie clip. all are seperate movie clips within a web page.
    I would like each of the buttons to have different aspects of control over the fourth main moovie clip.

    1.STOP/PLAY the 4th main movie, or maybe just pause it.

    2.STOP/PLAY the sound, which is an mp3 file in one of the buttons timelines.

    3.ON/OFF switch for the main movies loop sequence.

    Is this simple to do?

  2. #2
    are these buttons separate movies (.swf files)? or movie clips in one movie?

  3. #3
    Member
    Join Date
    Aug 2002
    Posts
    57
    They are seperate .swf files, within a web page.

    [Edited by Fluid X on 09-02-2002 at 08:25 AM]

  4. #4
    Member
    Join Date
    Aug 2002
    Posts
    57

    reviving this post

    I could still use some help or at least a little direction with this please.
    My project will be complete once I have this information.

  5. #5
    w w w . t h e o r y 7 . c o m nevil's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    1,216
    give the fourth movie clip an instance name, say "fourth", then target it from the buttons, use code like

    on(release){
    _root.fourth.play();
    }

    on(release){
    _root.fourth.stop();
    }

    on(release){
    _root.fourth.gotoAndPlay("mp3_file");
    }

    on(release){
    _root.fourth.gotoAndStop("stop_anim");
    }

    on(release){
    _root.fourth.gotoAndStop("play_anim");
    }


    if your 4th main movie clip is loaded as a level, then simply target the level, _levelx.gotoand.....



  6. #6
    Member
    Join Date
    Aug 2002
    Posts
    57
    Ok I tried It, couldn't seem to get it to work, maybe I just don't understand action script enough to fill in any gaps.

    I need a more detailed explanation, or I'm gonna to have to wade through a manual. The manual I have is massive, but I only need these buttons to work to finish my project.

  7. #7
    w w w . t h e o r y 7 . c o m nevil's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    1,216
    you have a fourth movie clip, right?
    so click on it an in the instance panel give it a name, got it?
    then put actions on each button as I showed you to target the movie clip and tell it what you want it to do, so on button 1 you might want to tell it to play your mp3 file so put

    on(release){
    _root.fourth.gotoAndPlay("mp3_file");
    }

    it's fairly simple, you will need to put the actionscript window in expert mode to put this code in.

  8. #8
    Member
    Join Date
    Aug 2002
    Posts
    57
    Yeh thanks, I understand naming instances and setting the actions, no problem, like I said its the actual script I have trouble with..

    Iv'e put the mp3 file in a separate movie clip thats placed on the web page.
    -----------------------------------------------
    on(release){
    _root.fourth.gotoAndPlay("mp3_file");
    }
    ----------------------------------------------
    I dont understand the part ("mp3_file")When its a movie im trying to control, not a file. Or maybe I should just use a file, can you do that?...........Now you have a better insight into what I understand and what I dont.


  9. #9
    w w w . t h e o r y 7 . c o m nevil's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    1,216
    I am asuming that you have a sound set in a keyframe, then if you give the keyframe a flasg name it will play the sound when you goto that frame, if you are using flash MX and are trying to load an external MP3 file then that is a different kettle of fish, you will need to use the loadMovie command.

  10. #10
    Member
    Join Date
    Aug 2002
    Posts
    57
    I have made a basic test web page containing two flash movies.
    http://www.inzane.plus.com/test

    One movie is the sound.
    The other is the button to control the sound.
    I,ve used the method you showed me, I must be stupid cause I can't get it work...So I have put the source files at http://www.inzane.plus.com/test/source

    Im using MX

  11. #11
    w w w . t h e o r y 7 . c o m nevil's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    1,216
    I really think you need to learn a bit more flash before you carry on, everything is wrong, ok here goes.

    1 - you have two seperate flash movies, and you are not loading one into the other, so they can't talk to each other across a html page, so first of all create a movie clip in your button movie and put a movie clip on the timeline, give it an instance name, call it mp3.

    2 - go inside the new movie clip and put a stop on frame 1, put the sound file on frame 2.

    3 - at the moment you have the button actions on the frame not the button, so you need to put those actions on the actual button.

    4 - I presume that you want the button to play or stop the music, so you are going to need two buttons, one to play and one to stop, or create a button inside a movie clip that switches states.

    5 - put the actions on the button:
    on(release){
    _root.mp3.gotoAndStop(2);
    }

    6 - if you want to add a stop then on your stop button put:

    on(release){
    _root.mp3.gotoAndStop(1);
    }

    then put a stopAllSounds(); on frame 1 of the movie where you put the sound file.

    this system uses one 1 flash movie, not two like you currently have.

  12. #12
    Member
    Join Date
    Aug 2002
    Posts
    57
    Ok I understand now.
    Thank you Nevil for your help and your patience.

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