Solved

ActionScript 3: Return if cursor in bottom

Posted on 2010-11-16
2
369 Views
Last Modified: 2013-11-11
If the cursor is within the bottom 25 pixels, I want to return.

I can get the number for the position of the bottom 25 pixels like this:
stage.stageHeight - 25

But I do not know how to get the number for where the cursor is.
public function hideControlBar(e:MouseEvent)
		{
			if( position_of_cursor > stage.stageHeight - 25 ) return;
			myTween = new Tween( controlCont, "y", Regular.easeInOut, 1, 26, .8, true );
			myTween.start();
		}

Open in new window

0
Comment
Question by:hankknight
2 Comments
 
LVL 10

Accepted Solution

by:
Carnou earned 500 total points
ID: 34148661
I believe you're looking for:
position_of_cursor = stage.mouseY;

Every DisplayObject (including the stage) has a mouseX and mouseY property that says where within that object the mouse is.
0
 
LVL 19

Expert Comment

by:moagrius
ID: 34148695
what carnou said is correct.

you also have access to it in the MouseEvent, as e.stageX and e.stageY



public function hideControlBar(e:MouseEvent)
		{
			if( e.stageY > stage.stageHeight - 25 ) return;
			myTween = new Tween( controlCont, "y", Regular.easeInOut, 1, 26, .8, true );
			myTween.start();
		}

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now