View Full Version : mouse rol over
Clemens
July 6th, 2002, 03:43 PM
hi,
i want a move start playing when the mouse roles over a certain place ( button )
i know how to do that when i use a button, but i dont wanna see the hand when u role over a button , i wanna keep the normall cursor.
how do i do that ?
coulnd find anything about it on this site or many others.
Thanks.
Clemens.
Clemens
July 6th, 2002, 04:06 PM
found something , but this is flash 6 and i got flash 5 so didnt work.
this is how it worked with flash 6.
give button instance name : something
add this action script at timeline of button on frame 1
something.useHandCursor = false;
But with flash 5 i cant give a instance name to a button. Or atleast i dont know how to.
Clemens.
sbeener
July 7th, 2002, 06:01 AM
you could run a hitTest on a regular movie:
onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse,_root._ymouse,true){
_root.myTargetMovie.play();
}
}
Clemens
July 7th, 2002, 07:37 AM
oki,
i made 2 movies.
movie1 i gave the action script :
onClipevent (enterframe) {
if (this.hitTest ( _root._xmouse , _root._ymouse, true )) {
_root.movie2.play();
};
}
but nothing happends but doesnt give any errors.
i am still new with actionscripting so maybe i did somethings wrong.
Clemens.
Iammontoya
July 7th, 2002, 07:51 AM
I will admit I have no idea what that script is supposed to do.
you're detecting collision of the x and y mouse position? That just doesnt look right to me.
My first reaction was to use getBounds on an mc of your choice, then detecting whether or mouse your _xmouse or your _ymouse was withing that range. However, if the code by supra works, that may be easier. If not, then you would, of course, have to use local to global to convert the coordinates from the mc to actual coordinates on your main movie.
sbeener
July 7th, 2002, 03:00 PM
aside from missing a bracket (oops, you've corrected it clemens), the script is fine.
it's hit testing "this" against the mouse coordinates ... effectively checking for a mouse over.
if the movie is nested, use _parent._xmouse rather than _root.
add a trace action to be sure whether it's executing at all
onClipEvent (enterFrame) {
if (this.hitTest(_parent._xmouse, _parent._ymouse, true)) {
trace("hit");
}
}
also, you don't want this movie to continue doing this once the movie plays, so maybe best to assign it by putting something like this on the timeline (assuming the movie's name is "sqr"):
_root.sqr.onEnterFrame = function(){
if (this.hitTest(this._parent._xmouse, this._parent._ymouse, false)) {
trace("hit");
this.onEnterFrame = null;
}
}
since this movie is square, there's no reason to evaluate the shape - that's why the last argument in hitTest is false now. also note that "this" has been added before _parent since the default timeline is no longer sqr.
this method allows you to cancel it once it happens.
it's mx dependant though.
Clemens
July 7th, 2002, 05:55 PM
well thank you for your time.
i will try the things soon and hope it works.
but i dont have mx yet.
Clemens.
Clemens
July 7th, 2002, 06:19 PM
did the hit test and that works fine.
going to try the rest now.
Clemens.
Clemens
July 7th, 2002, 06:35 PM
hehe , me again.
as i sayed , i jsut started to play with scripting.
i am able to script this :
onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse,_root._ymouse,true){ }
}
i just cant add the action : _root.movie2.play()
i dont get it between the two { }
if i choose play() from the menu i cant add parameters.
i know its a beginner question but i tryed and tryed but cant figure it out.
pitty me.
sbeener
July 7th, 2002, 07:50 PM
press ctrl-shft-E and cast off your shackles!
then just type it in like a normal human being. ; )
Iammontoya
July 7th, 2002, 09:27 PM
hehehehe.. that's funny.
the best thing you can do for yourself if you're trying to learn actionscript is to go to Expert Mode and never look back! Ever!
Clemens
July 8th, 2002, 05:50 AM
Thanks for all your help guys.
im still at beginning with action script but doing all i can
Clemens.
Clemens
July 8th, 2002, 05:54 AM
yes yes , it works now.
yahooooo
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.