Solved

Keep Custom Cursor At the Highest Depth

Posted on 2010-09-12
4
403 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
  • 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 250 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

756 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