Solved

ActionScript 3: Return if cursor in bottom

Posted on 2010-11-16
2
374 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

739 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