Hi guys,
I have seen this on a couple of sites and would know how to do this effect…
How do i start and stop a movie clip with only one button using the onMouserelease function
Hi guys,
I have seen this on a couple of sites and would know how to do this effect…
How do i start and stop a movie clip with only one button using the onMouserelease function
Assuming you are talking about stopping one movie clip and starting another (since it would make no sense to stop and restard just 1 clip) You can just assign it like this…
on (release){
_root.yourClip.stop();
_root.yourClip2.play();
}
thanks for the quick reply lost, but thats exactly what i wanted to do…stop and once again start the movie clip (only one) with one button… something similar to the music players that you see in most of the flash designed sites where the play button when pressed changes to a pause button and on pressing pause it changes to a play button…hehe as i am typing this I think i know what should be done…and it seems pretty silly right now…
It sounds like you mean the same method I used above, but with one clip instead of 2.
Let me know if your idea worked out.
make a movie clip that looks like play a button. Place a stop action on it’s first frame. Create the look of the pause button on the second frame.
on(press){
_root.yourClip.gotoAndStop(2);
}
on (release){
_root.yourClip.gotoAndStop(1);
}
:-\
Hey lost,
I tried it my way and it worked just great. I am not yet an “expert mode” scripter but hope to reach there some day… although I understand AS to a certain extent I am not very proficient in it and hence I don’t know how to incorporate your code with what I wanted but would love to know how to do it.
David thanks for the quick reply too but i believe that it would not work the way i was thinking of as on clicking the mouse it would change to ‘pause’ and on releasing the mouse button it would change back to ‘play’ which would mean that the button would show ‘pause’ only if the mouse button is kept pressed, hence my player would continuously show ‘play’. But i did get the general idea of how to do it and am grateful for the quick replies.
well I’m glad it worked. Im unsure of why I thought that’s the way you wanted it to work. It is easy enough to change though
on (release){
if(trip){
_root.yourClip.stop();
trip=false;
}else{
_root.yourClip.play();
trip=true;
}
}
Hello David,
Thanks for sending the change but I would like to know what the ‘trip’ function is or is it just a name like you would give to a variable…
Also I think you got the idea of what i wanted except that the code that you put up would not have had two click functions on the same button which is what i actually wanted…
yeah ‘trip’ is the name I usually use for a trip inside of my scripts. It’s an arbetrary name.
I guess I don’t understand what you’re looking to do. You can place as many actions under if(trip){ statement that you like. If you want to do two things, put them both in there, if you want to do three, put all three in there. You can have a single action by the user trigger any number of coinciding events.
oh I think I get what you’re trying to say.
you need it to not only pause the music, but also change states to a secondary pause look.
in these cases, I make my button… or rather what the people see as the button, a movie clip. I make a movie clip with four frames, and construct those frames just as I would for a button. Create a new layer and place a stop(); action in the first frame. Give the new movie clip an instance name, like “buttonClip”.
now you place a real button on top of the movie clip. This button should have nothing in the first three frames, but should have fill in it’s hit frame the size of the movie clip that’s underneith it.
Then the button just has to have something like this.
on (release){
if(trip){
_root.buttonClip.gotoAndStop(1);
trip=false;
}else{
_root.buttonClip.gotoAndStop(2);
trip=true;
}
}
For reference, there is actually a way of doing a real pause button where a sound is stopped, and then started from where it left off. This is tricky though… so let me know if you’re trying to make a pause button for music before I go into it.
hey David,
yeah you got what i was asking for although u code it differently…than what i had thought. I am not really interested in putting music right now but would love to know how to code the way you’ll do…(how long did u take to learn to code and from where did u learn…) however i used the ‘play-pause’ button as a reference to what i was really asking for help with…but am still interested in learning how to add music and pausing it and stuff…
:: Copyright KIRUPA 2024 //--