# Actionscript for a mouseclick

**URL:** <https://forum.kirupa.com/t/actionscript-for-a-mouseclick/245357>\
**Category:** Uncategorized\
**Created:** [November 28, 2007, 8:44pm UTC](https://forum.kirupa.com/t/actionscript-for-a-mouseclick/245357 "2007-11-28T20:44:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndippy](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@ndippy](https://forum.kirupa.com/u/ndippy)\
**Post date:** [November 28, 2007, 8:44pm UTC](https://forum.kirupa.com/t/actionscript-for-a-mouseclick/245357/1 "2007-11-28T20:44:06Z")

</div>

hi everyone,  
I have a question , how to write a actionscript code for a button when the button is clicked it should move to the nextframe.  
// About and smile1 button scripts  
stop();  
\_root.smile1.onPress = function() {  
if (mouse\_over\_smile1) {  
\_root.smile1.gotoAndStop(5);  
} else {  
\_root.smile1.prevFrame();  
}  
};

// animation for the smile2 button

\_root.smile2.onRelease = function() {  
if (mouse\_press\_smile2) {  
\_root.smile2.gotoAndStop(6);  
} else {  
\_root.smile2.stop();  
}  
};  
// animation for the smile3 button

\_root.smile3.onEnterFrame = function() {  
if (mouse\_over\_smile3) {  
\_root.smile3.gotoAndStop(7);  
} else {  
\_root.smile3.prevFrame();  
}  
};

i have given 3 functions as onEnterFrame,onPress,onRelease. i tried all these but didnt get the result.  
smile1,smile2,smile3 are button instances which are declared on the monie clip.  
my main thing is i hav a button, when i click on that button it should go the next frame which i have declared in “gotoAndPlay(6)” method. can any one write the code for me.  
i need it urgently.  
Thank You.
