Skip to main content
Inspiring
November 16, 2010
Answered

How to show prompt ?

  • November 16, 2010
  • 1 reply
  • 774 views

I have a object,and I want to add it into mouse over and mouse out event,when mouse over the object,it will show a prompt information beyond the object by using a window or dialog box,when the mouse out of the object,the prompt will disappear.

My question is how to show prompt information beyond the object by using actionscript3? Is there any model? An example is better.

Thanks.

This topic has been closed for replies.
Correct answer Ned Murphy

If the object is a movieclip, then you need to add event listeners for that object for the ROLL_OVER and ROLL_OUT MouseEvents.  In the event handler functions for those listeners you could trigger the prompt to appear.  Just make the prompt a movieclip symbol and give it an instance name and control its visible property with the event handler functions.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
November 16, 2010

If the object is a movieclip, then you need to add event listeners for that object for the ROLL_OVER and ROLL_OUT MouseEvents.  In the event handler functions for those listeners you could trigger the prompt to appear.  Just make the prompt a movieclip symbol and give it an instance name and control its visible property with the event handler functions.

Inspiring
November 16, 2010

>> In the event handler functions for those listeners you could trigger the prompt to appear.  Just make the prompt a movieclip symbol and give it an instance name and control its visible property with the event handler functions.

My object is a Ball,then I add MouseEvent into this object. Now I don't know how to write code about prompt,such as follows:

private var ball:Ball;

......

public function onMouseOver(event:MouseEvent){

     ??? //here,how to write prompt code?

}

Would you give me an example code?

Thanks in advance.

Ned Murphy
Legend
November 16, 2010

For what I described trying, it could be as simple as...

public function onMouseOver(event:MouseEvent){

     prompt.visible = true;

}

public function onMouseOut(event:MouseEvent){

     prompt.visible = false;

}