?
Solved

Keep Custom Cursor At the Highest Depth

Posted on 2010-09-12
4
Medium Priority
?
410 Views
Last Modified: 2012-05-10
I'm adding a custom cursor, and I need it to stay at the highest depth. Currently, whenever I add new movie clips to the screen, the custom mouse shows up behind the movie clips, which looks terrible.  I have to add movie clips regularly during runtime, but I need the custom cursor to stay above them, just like the regular mouse would.

Here's how I'm adding the custom cursor:

                        Mouse.hide();
                  var cross= new crosshairs();
                  this.addChild(cross);
                  cross.depth = 999999;
                  cross.startDrag(true);
                       
0
Comment
Question by:walker6o9
[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
4 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 33659983
walker are you trying to do this in AS2 or AS3?
0
 
LVL 3

Accepted Solution

by:
cconstable_work earned 1000 total points
ID: 33660030
What version of Actionscript are you using?
You could:
this.addChildAt(cross, 0);

Then all other movie clips:
this.addChildAt(other_mc, 0);

this would ensure that the cross is continually pushed to the top when a new movie clip is added.

Or you could add a new container movie clip for your cursor and another container for everything else.

import flash.display.MovieClip;

var myMouseContainer:MovieClip = new MovieClip();
var myEverythingElseContainer:MovieClip = new MovieClip();
stage.addChild(myEverythingElseContainer);
stage.addChild(myMouseContainer);
var myCross:MovieClip = new cross_mc();
var myEverythingElse:MovieClip = new block_mc();
myMouseContainer.addChild(myCross);
myEverythingElseContainer.addChild(myEverythingElse);
0
 
LVL 1

Author Comment

by:walker6o9
ID: 33686448
This works, except that I can't click on anything.
0
 
LVL 3

Expert Comment

by:cconstable_work
ID: 33687167
Again not sure what version of action script you are using.
If you have a movie clip covering other movie clips and need to be able to click through it add:
my_mc.mouseEnabled = false;
this will stop the movie clip from being click-able which allows you to click things under it.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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 how to how to record live broadcast.
Suggested Courses

801 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