1 Replies - 6658 Views - Last Post: 19 April 2006 - 03:19 AM

#1 Dilerious  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 2
  • View blog
  • Posts: 280
  • Joined: 30-December 05

Off mouse event

Posted 14 April 2006 - 09:39 AM

Ok, i have my mouse event, it makes the button move up when you hover the mouse over the button. But when i move the mouse off the button it just snaps back to it's origional position, and doesn't slide back down. What's the code for the mouse off event?

This post has been edited by Dilerious: 14 April 2006 - 09:40 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Off mouse event

#2 michelle@urban  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 1
  • View blog
  • Posts: 309
  • Joined: 09-July 05

Re: Off mouse event

Posted 19 April 2006 - 03:19 AM

The fact that it is snapping back to its original positions says that it already has a roll out function. Your problem lies in how it is getting back to its original position, how have you got the button to slide upwards? If it's using keyframes can you not just reverse them to get the effect coming down?

For your "mouse off event" the following code tells the object to move to an x position of 100 on roll out (roll out is the correct mouse off) obviously you will have to change the properties to make your button do what you want it to do.

//attach this code directly onto your button
on(rollOut){
	this._x = 100;
}


Personally I prefer attaching the script to the timeline as opposed to the object if you want to do it this way use:

//attach this code to the timeline on a locked layer named actions
this.yourbutton_btn.onRollOut = function(){
	this._x = 100;
}


This is more long winded but if you are using alot of code it makes it easier to locate it as it will all be in the timeline. Note: If using this method don't forget to give your button a instance name, you can double check this by targeting your button using the target option in the actions window.

Hope this helps :D

Edit: forgot to put the code in the highlighted boxes doh ;)

This post has been edited by michelle@urban: 19 April 2006 - 03:21 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1