-
Movieclip onpress
Hi there.
Basically trying to set a gotoAndPlay event on a movie clip (onPress / onRelease)
I've tried laying an invisible button over the top of the movie clip which did work, but disabled the movie clip from playing on rollover.
I found the following code on a Adobe forum, but don't really understand it.
myMovieClip.onPress = function () {
trace ("onPress called");
};
Any ideas would be much appreciated - i know questions like this might be a little tedious.
THanks
-
If you want it to do something when the button is clicked, use:
Actionscript Code:
myMovieClip.onRelease = function(){ trace("onRelease Called"); }
Otherwise, if you want it to do something when the button is pressed down, use:
Actionscript Code:
myMovieClip.onMouseDown = function(){ trace("onMouseDown Called"); }
Last edited by Osteel; 05-12-2010 at 09:45 PM.
-
Hey Osteel, thanks for replying.
...but how/where do i define the 'gotoAndPlay'?
-
Sorry, I read your question wrong the first time.
Well, just inside the function. So, assuming you want your main timeline to gotoAndPlay a frame:
PHP Code:
myMovieClip.onPress = function () { _root.gotoAndPlay(2); // change the 2 to the frame number you want };
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|